diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticCollection.cs index 26e1a9c5b771..7b26b3a6cc49 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticCollection.cs @@ -20,8 +20,8 @@ namespace Azure.ResourceManager.ApiManagement { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiDiagnostics method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetApiDiagnostics method from an instance of . /// public partial class ApiDiagnosticCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -48,8 +48,8 @@ internal ApiDiagnosticCollection(ArmClient client, ResourceIdentifier id) : base internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiResource.ResourceType), nameof(id)); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticResource.cs index 716ad76b8c19..198d7003d3c1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticResource.cs @@ -20,7 +20,7 @@ namespace Azure.ResourceManager.ApiManagement /// A Class representing an ApiDiagnostic along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetApiDiagnosticResource method. - /// Otherwise you can get one from its parent resource using the GetApiDiagnostic method. + /// Otherwise you can get one from its parent resource using the GetApiDiagnostic method. /// public partial class ApiDiagnosticResource : ArmResource { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCollection.cs index 3131139ca879..e8a2c6a1c412 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCollection.cs @@ -20,8 +20,8 @@ namespace Azure.ResourceManager.ApiManagement { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiIssues method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetApiIssues method from an instance of . /// public partial class ApiIssueCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -48,8 +48,8 @@ internal ApiIssueCollection(ArmClient client, ResourceIdentifier id) : base(clie internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiResource.ResourceType), nameof(id)); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueResource.cs index b3b97299b544..d65789aa8e71 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueResource.cs @@ -21,7 +21,7 @@ namespace Azure.ResourceManager.ApiManagement /// A Class representing an ApiIssue along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetApiIssueResource method. - /// Otherwise you can get one from its parent resource using the GetApiIssue method. + /// Otherwise you can get one from its parent resource using the GetApiIssue method. /// public partial class ApiIssueResource : ArmResource { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerData.cs index 5598cd1cbd7b..73fd12cc8b27 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerData.cs @@ -44,12 +44,14 @@ public ApiManagementAuthorizationServerData() /// Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. /// Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. /// User-friendly authorization server name. + /// If true, the authorization server may be used in the developer portal test console. True by default if no value is provided. + /// If true, the authorization server will be used in the API documentation in the developer portal. False by default if no value is provided. /// Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. /// OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. /// Form of an authorization grant, which the client uses to request the access token. /// Client or app id registered with this authorization server. /// Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - internal ApiManagementAuthorizationServerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, IList authorizationMethods, IList clientAuthenticationMethods, IList tokenBodyParameters, string tokenEndpoint, bool? doesSupportState, string defaultScope, IList bearerTokenSendingMethods, string resourceOwnerUsername, string resourceOwnerPassword, string displayName, string clientRegistrationEndpoint, string authorizationEndpoint, IList grantTypes, string clientId, string clientSecret) : base(id, name, resourceType, systemData) + internal ApiManagementAuthorizationServerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, IList authorizationMethods, IList clientAuthenticationMethods, IList tokenBodyParameters, string tokenEndpoint, bool? doesSupportState, string defaultScope, IList bearerTokenSendingMethods, string resourceOwnerUsername, string resourceOwnerPassword, string displayName, bool? useInTestConsole, bool? useInApiDocumentation, string clientRegistrationEndpoint, string authorizationEndpoint, IList grantTypes, string clientId, string clientSecret) : base(id, name, resourceType, systemData) { Description = description; AuthorizationMethods = authorizationMethods; @@ -62,6 +64,8 @@ internal ApiManagementAuthorizationServerData(ResourceIdentifier id, string name ResourceOwnerUsername = resourceOwnerUsername; ResourceOwnerPassword = resourceOwnerPassword; DisplayName = displayName; + UseInTestConsole = useInTestConsole; + UseInApiDocumentation = useInApiDocumentation; ClientRegistrationEndpoint = clientRegistrationEndpoint; AuthorizationEndpoint = authorizationEndpoint; GrantTypes = grantTypes; @@ -91,6 +95,10 @@ internal ApiManagementAuthorizationServerData(ResourceIdentifier id, string name public string ResourceOwnerPassword { get; set; } /// User-friendly authorization server name. public string DisplayName { get; set; } + /// If true, the authorization server may be used in the developer portal test console. True by default if no value is provided. + public bool? UseInTestConsole { get; set; } + /// If true, the authorization server will be used in the API documentation in the developer portal. False by default if no value is provided. + public bool? UseInApiDocumentation { get; set; } /// Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. public string ClientRegistrationEndpoint { get; set; } /// OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendData.cs index 077d2b7296d9..537a8edb53c6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Models; @@ -30,14 +31,15 @@ public ApiManagementBackendData() /// The systemData. /// Backend Title. /// Backend Description. - /// Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. + /// Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. /// Backend Properties contract. /// Backend Credentials Contract Properties. - /// Backend Proxy Contract Properties. + /// Backend gateway Contract Properties. /// Backend TLS Properties. + /// Backend Circuit Breaker Configuration. /// Runtime Url of the Backend. /// Backend communication protocol. - internal ApiManagementBackendData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string title, string description, Uri resourceUri, BackendProperties properties, BackendCredentialsContract credentials, BackendProxyContract proxy, BackendTlsProperties tls, Uri uri, BackendProtocol? protocol) : base(id, name, resourceType, systemData) + internal ApiManagementBackendData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string title, string description, Uri resourceUri, BackendProperties properties, BackendCredentialsContract credentials, BackendProxyContract proxy, BackendTlsProperties tls, BackendCircuitBreaker circuitBreaker, Uri uri, BackendProtocol? protocol) : base(id, name, resourceType, systemData) { Title = title; Description = description; @@ -46,6 +48,7 @@ internal ApiManagementBackendData(ResourceIdentifier id, string name, ResourceTy Credentials = credentials; Proxy = proxy; Tls = tls; + CircuitBreaker = circuitBreaker; Uri = uri; Protocol = protocol; } @@ -54,7 +57,7 @@ internal ApiManagementBackendData(ResourceIdentifier id, string name, ResourceTy public string Title { get; set; } /// Backend Description. public string Description { get; set; } - /// Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. + /// Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. public Uri ResourceUri { get; set; } /// Backend Properties contract. internal BackendProperties Properties { get; set; } @@ -72,10 +75,23 @@ public BackendServiceFabricClusterProperties BackendServiceFabricCluster /// Backend Credentials Contract Properties. public BackendCredentialsContract Credentials { get; set; } - /// Backend Proxy Contract Properties. + /// Backend gateway Contract Properties. public BackendProxyContract Proxy { get; set; } /// Backend TLS Properties. public BackendTlsProperties Tls { get; set; } + /// Backend Circuit Breaker Configuration. + internal BackendCircuitBreaker CircuitBreaker { get; set; } + /// The rules for tripping the backend. + public IList CircuitBreakerRules + { + get + { + if (CircuitBreaker is null) + CircuitBreaker = new BackendCircuitBreaker(); + return CircuitBreaker.Rules; + } + } + /// Runtime Url of the Backend. public Uri Uri { get; set; } /// Backend communication protocol. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendResource.cs index 6fe935696def..0e26ad530260 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendResource.cs @@ -292,7 +292,7 @@ public virtual Response Update(ETag ifMatch, ApiMa } /// - /// 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. + /// 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. /// /// /// Request Path @@ -323,7 +323,7 @@ public virtual async Task ReconnectAsync(BackendReconnectContract back } /// - /// 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. + /// 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. /// /// /// Request Path diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderData.cs index ca8db35f2468..6b1e104d1181 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderData.cs @@ -37,9 +37,10 @@ public ApiManagementIdentityProviderData() /// Signin Policy Name. Only applies to AAD B2C Identity Provider. /// Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. /// Password Reset Policy Name. Only applies to AAD B2C Identity Provider. + /// The client library to be used in the developer portal. Only applies to AAD and AAD B2C Identity Provider. /// Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. /// 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. - internal ApiManagementIdentityProviderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IdentityProviderType? identityProviderType, string signInTenant, IList allowedTenants, string authority, string signUpPolicyName, string signInPolicyName, string profileEditingPolicyName, string passwordResetPolicyName, string clientId, string clientSecret) : base(id, name, resourceType, systemData) + internal ApiManagementIdentityProviderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IdentityProviderType? identityProviderType, string signInTenant, IList allowedTenants, string authority, string signUpPolicyName, string signInPolicyName, string profileEditingPolicyName, string passwordResetPolicyName, string clientLibrary, string clientId, string clientSecret) : base(id, name, resourceType, systemData) { IdentityProviderType = identityProviderType; SignInTenant = signInTenant; @@ -49,6 +50,7 @@ internal ApiManagementIdentityProviderData(ResourceIdentifier id, string name, R SignInPolicyName = signInPolicyName; ProfileEditingPolicyName = profileEditingPolicyName; PasswordResetPolicyName = passwordResetPolicyName; + ClientLibrary = clientLibrary; ClientId = clientId; ClientSecret = clientSecret; } @@ -69,6 +71,8 @@ internal ApiManagementIdentityProviderData(ResourceIdentifier id, string name, R public string ProfileEditingPolicyName { get; set; } /// Password Reset Policy Name. Only applies to AAD B2C Identity Provider. public string PasswordResetPolicyName { get; set; } + /// The client library to be used in the developer portal. Only applies to AAD and AAD B2C Identity Provider. + public string ClientLibrary { get; set; } /// Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. public string ClientId { get; set; } /// 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. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderData.cs index 27c2aa10da60..aa49092ff1b0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderData.cs @@ -31,13 +31,17 @@ public ApiManagementOpenIdConnectProviderData() /// Metadata endpoint URI. /// Client ID of developer console which is the client application. /// Client Secret of developer console which is the client application. - internal ApiManagementOpenIdConnectProviderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string description, string metadataEndpoint, string clientId, string clientSecret) : base(id, name, resourceType, systemData) + /// If true, the Open ID Connect provider may be used in the developer portal test console. True by default if no value is provided. + /// 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. + internal ApiManagementOpenIdConnectProviderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string description, string metadataEndpoint, string clientId, string clientSecret, bool? useInTestConsole, bool? useInApiDocumentation) : base(id, name, resourceType, systemData) { DisplayName = displayName; Description = description; MetadataEndpoint = metadataEndpoint; ClientId = clientId; ClientSecret = clientSecret; + UseInTestConsole = useInTestConsole; + UseInApiDocumentation = useInApiDocumentation; } /// User-friendly OpenID Connect Provider name. @@ -50,5 +54,9 @@ internal ApiManagementOpenIdConnectProviderData(ResourceIdentifier id, string na public string ClientId { get; set; } /// Client Secret of developer console which is the client application. public string ClientSecret { get; set; } + /// If true, the Open ID Connect provider may be used in the developer portal test console. True by default if no value is provided. + public bool? UseInTestConsole { get; set; } + /// 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. + public bool? UseInApiDocumentation { get; set; } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyCollection.cs index d5e0778e400f..1b5d3ef68b35 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyCollection.cs @@ -21,8 +21,8 @@ namespace Azure.ResourceManager.ApiManagement { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiManagementProductPolicies method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetApiManagementProductPolicies method from an instance of . /// public partial class ApiManagementProductPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -49,8 +49,8 @@ internal ApiManagementProductPolicyCollection(ArmClient client, ResourceIdentifi internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiManagementProductResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementProductResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceProductResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceProductResource.ResourceType), nameof(id)); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyResource.cs index 13bd27033ea8..ed0b98836d55 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyResource.cs @@ -21,7 +21,7 @@ namespace Azure.ResourceManager.ApiManagement /// A Class representing an ApiManagementProductPolicy along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetApiManagementProductPolicyResource method. - /// Otherwise you can get one from its parent resource using the GetApiManagementProductPolicy method. + /// Otherwise you can get one from its parent resource using the GetApiManagementProductPolicy method. /// public partial class ApiManagementProductPolicyResource : ArmResource { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagCollection.cs index 47b82e5f75e8..9751d7942e6b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagCollection.cs @@ -20,8 +20,8 @@ namespace Azure.ResourceManager.ApiManagement { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiManagementProductTags method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetApiManagementProductTags method from an instance of . /// public partial class ApiManagementProductTagCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -48,8 +48,8 @@ internal ApiManagementProductTagCollection(ArmClient client, ResourceIdentifier internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiManagementProductResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementProductResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceProductResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceProductResource.ResourceType), nameof(id)); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagResource.cs index 6c7af5970e88..3996bbc7f237 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagResource.cs @@ -20,7 +20,7 @@ namespace Azure.ResourceManager.ApiManagement /// A Class representing an ApiManagementProductTag along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetApiManagementProductTagResource method. - /// Otherwise you can get one from its parent resource using the GetApiManagementProductTag method. + /// Otherwise you can get one from its parent resource using the GetApiManagementProductTag method. /// public partial class ApiManagementProductTagResource : ArmResource { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceData.cs index 0f3b03ad24e2..030a38c080c0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceData.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceData.cs @@ -41,6 +41,7 @@ public ApiManagementServiceData(AzureLocation location, ApiManagementServiceSkuP AdditionalLocations = new ChangeTrackingList(); CustomProperties = new ChangeTrackingDictionary(); Certificates = new ChangeTrackingList(); + OutboundPublicIPAddresses = new ChangeTrackingList(); PrivateEndpointConnections = new ChangeTrackingList(); PublisherEmail = publisherEmail; PublisherName = publisherName; @@ -74,9 +75,11 @@ public ApiManagementServiceData(AzureLocation location, ApiManagementServiceSkuP /// Whether or not public endpoint access is allowed for this API Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. /// Virtual network configuration of the API Management service. /// Additional datacenter locations of the API Management service. - /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>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`.</br></br>You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. 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: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>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 1, 2018 and `False` otherwise. Http2 setting's default value is `False`.</br></br>You can disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them.</br> Note: The following ciphers can't be disabled since they are required by internal platform components: TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. /// List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. /// Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. + /// Property can be used to enable NAT Gateway for this API Management service. + /// Outbound public IPV4 address prefixes associated with NAT Gateway deployed service. Available only for Premium SKU on stv2 platform. /// Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. /// The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. /// Control Plane Apis version constraint for the API Management service. @@ -85,7 +88,7 @@ public ApiManagementServiceData(AzureLocation location, ApiManagementServiceSkuP /// Compute Platform Version running the service in this location. /// Publisher email. /// Publisher name. - internal ApiManagementServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ApiManagementServiceSkuProperties sku, ManagedServiceIdentity identity, ETag? etag, IList zones, string notificationSenderEmail, string provisioningState, string targetProvisioningState, DateTimeOffset? createdAtUtc, Uri gatewayUri, Uri gatewayRegionalUri, Uri portalUri, Uri managementApiUri, Uri scmUri, Uri developerPortalUri, IList hostnameConfigurations, IReadOnlyList publicIPAddresses, IReadOnlyList privateIPAddresses, ResourceIdentifier publicIPAddressId, PublicNetworkAccess? publicNetworkAccess, VirtualNetworkConfiguration virtualNetworkConfiguration, IList additionalLocations, IDictionary customProperties, IList certificates, bool? enableClientCertificate, bool? disableGateway, VirtualNetworkType? virtualNetworkType, ApiVersionConstraint apiVersionConstraint, bool? restore, IList privateEndpointConnections, PlatformVersion? platformVersion, string publisherEmail, string publisherName) : base(id, name, resourceType, systemData, tags, location) + internal ApiManagementServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ApiManagementServiceSkuProperties sku, ManagedServiceIdentity identity, ETag? etag, IList zones, string notificationSenderEmail, string provisioningState, string targetProvisioningState, DateTimeOffset? createdAtUtc, Uri gatewayUri, Uri gatewayRegionalUri, Uri portalUri, Uri managementApiUri, Uri scmUri, Uri developerPortalUri, IList hostnameConfigurations, IReadOnlyList publicIPAddresses, IReadOnlyList privateIPAddresses, ResourceIdentifier publicIPAddressId, PublicNetworkAccess? publicNetworkAccess, VirtualNetworkConfiguration virtualNetworkConfiguration, IList additionalLocations, IDictionary customProperties, IList certificates, bool? enableClientCertificate, NatGatewayState? natGatewayState, IReadOnlyList outboundPublicIPAddresses, bool? disableGateway, VirtualNetworkType? virtualNetworkType, ApiVersionConstraint apiVersionConstraint, bool? restore, IList privateEndpointConnections, PlatformVersion? platformVersion, string publisherEmail, string publisherName) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; Identity = identity; @@ -111,6 +114,8 @@ internal ApiManagementServiceData(ResourceIdentifier id, string name, ResourceTy CustomProperties = customProperties; Certificates = certificates; EnableClientCertificate = enableClientCertificate; + NatGatewayState = natGatewayState; + OutboundPublicIPAddresses = outboundPublicIPAddresses; DisableGateway = disableGateway; VirtualNetworkType = virtualNetworkType; ApiVersionConstraint = apiVersionConstraint; @@ -163,12 +168,16 @@ internal ApiManagementServiceData(ResourceIdentifier id, string name, ResourceTy public VirtualNetworkConfiguration VirtualNetworkConfiguration { get; set; } /// Additional datacenter locations of the API Management service. public IList AdditionalLocations { get; } - /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>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`.</br></br>You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. 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: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>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 1, 2018 and `False` otherwise. Http2 setting's default value is `False`.</br></br>You can disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them.</br> Note: The following ciphers can't be disabled since they are required by internal platform components: TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. public IDictionary CustomProperties { get; } /// List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. public IList Certificates { get; } /// Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. public bool? EnableClientCertificate { get; set; } + /// Property can be used to enable NAT Gateway for this API Management service. + public NatGatewayState? NatGatewayState { get; set; } + /// Outbound public IPV4 address prefixes associated with NAT Gateway deployed service. Available only for Premium SKU on stv2 platform. + public IReadOnlyList OutboundPublicIPAddresses { get; } /// Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. public bool? DisableGateway { get; set; } /// The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceResource.cs index d66c4e91f8cd..c9d2c200d150 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceResource.cs @@ -36,8 +36,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly ClientDiagnostics _apiManagementServiceClientDiagnostics; private readonly ApiManagementServiceRestOperations _apiManagementServiceRestClient; - private readonly ClientDiagnostics _apiClientDiagnostics; - private readonly ApiRestOperations _apiRestClient; + private readonly ClientDiagnostics _serviceApiApiClientDiagnostics; + private readonly ApiRestOperations _serviceApiApiRestClient; private readonly ClientDiagnostics _defaultClientDiagnostics; private readonly ApiManagementRestOperations _defaultRestClient; private readonly ClientDiagnostics _contentTypeClientDiagnostics; @@ -54,8 +54,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly PolicyDescriptionRestOperations _policyDescriptionRestClient; private readonly ClientDiagnostics _apiManagementServicePortalSettingsClientDiagnostics; private readonly PortalSettingsRestOperations _apiManagementServicePortalSettingsRestClient; - private readonly ClientDiagnostics _apiManagementProductProductClientDiagnostics; - private readonly ProductRestOperations _apiManagementProductProductRestClient; + private readonly ClientDiagnostics _serviceProductProductClientDiagnostics; + private readonly ProductRestOperations _serviceProductProductRestClient; private readonly ClientDiagnostics _quotaByCounterKeysClientDiagnostics; private readonly QuotaByCounterKeysRestOperations _quotaByCounterKeysRestClient; private readonly ClientDiagnostics _quotaByPeriodKeysClientDiagnostics; @@ -92,9 +92,9 @@ internal ApiManagementServiceResource(ArmClient client, ResourceIdentifier id) : _apiManagementServiceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string apiManagementServiceApiVersion); _apiManagementServiceRestClient = new ApiManagementServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementServiceApiVersion); - _apiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiResource.ResourceType, out string apiApiVersion); - _apiRestClient = new ApiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiApiVersion); + _serviceApiApiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceApiResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceApiResource.ResourceType, out string serviceApiApiApiVersion); + _serviceApiApiRestClient = new ApiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiApiApiVersion); _defaultClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); _defaultRestClient = new ApiManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _contentTypeClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); @@ -112,9 +112,9 @@ internal ApiManagementServiceResource(ArmClient client, ResourceIdentifier id) : _apiManagementServicePortalSettingsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string apiManagementServicePortalSettingsApiVersion); _apiManagementServicePortalSettingsRestClient = new PortalSettingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementServicePortalSettingsApiVersion); - _apiManagementProductProductClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiManagementProductResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiManagementProductResource.ResourceType, out string apiManagementProductProductApiVersion); - _apiManagementProductProductRestClient = new ProductRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementProductProductApiVersion); + _serviceProductProductClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceProductResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceProductResource.ResourceType, out string serviceProductProductApiVersion); + _serviceProductProductRestClient = new ProductRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceProductProductApiVersion); _quotaByCounterKeysClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); _quotaByCounterKeysRestClient = new QuotaByCounterKeysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _quotaByPeriodKeysClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); @@ -156,11 +156,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } - /// Gets a collection of ApiResources in the ApiManagementService. - /// An object representing collection of ApiResources and their operations over a ApiResource. - public virtual ApiCollection GetApis() + /// Gets a collection of ServiceApiResources in the ApiManagementService. + /// An object representing collection of ServiceApiResources and their operations over a ServiceApiResource. + public virtual ServiceApiCollection GetServiceApis() { - return GetCachedClient(Client => new ApiCollection(Client, Id)); + return GetCachedClient(Client => new ServiceApiCollection(Client, Id)); } /// @@ -181,9 +181,9 @@ public virtual ApiCollection GetApis() /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual async Task> GetApiAsync(string apiId, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceApiAsync(string apiId, CancellationToken cancellationToken = default) { - return await GetApis().GetAsync(apiId, cancellationToken).ConfigureAwait(false); + return await GetServiceApis().GetAsync(apiId, cancellationToken).ConfigureAwait(false); } /// @@ -204,9 +204,9 @@ public virtual async Task> GetApiAsync(string apiId, Cance /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual Response GetApi(string apiId, CancellationToken cancellationToken = default) + public virtual Response GetServiceApi(string apiId, CancellationToken cancellationToken = default) { - return GetApis().Get(apiId, cancellationToken); + return GetServiceApis().Get(apiId, cancellationToken); } /// Gets a collection of ApiManagementPolicyResources in the ApiManagementService. @@ -419,11 +419,11 @@ public virtual Response GetApiManagementIssue(string return GetApiManagementIssues().Get(issueId, cancellationToken); } - /// Gets a collection of ApiVersionSetResources in the ApiManagementService. - /// An object representing collection of ApiVersionSetResources and their operations over a ApiVersionSetResource. - public virtual ApiVersionSetCollection GetApiVersionSets() + /// Gets a collection of ServiceApiVersionSetResources in the ApiManagementService. + /// An object representing collection of ServiceApiVersionSetResources and their operations over a ServiceApiVersionSetResource. + public virtual ServiceApiVersionSetCollection GetServiceApiVersionSets() { - return GetCachedClient(Client => new ApiVersionSetCollection(Client, Id)); + return GetCachedClient(Client => new ServiceApiVersionSetCollection(Client, Id)); } /// @@ -444,9 +444,9 @@ public virtual ApiVersionSetCollection GetApiVersionSets() /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual async Task> GetApiVersionSetAsync(string versionSetId, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceApiVersionSetAsync(string versionSetId, CancellationToken cancellationToken = default) { - return await GetApiVersionSets().GetAsync(versionSetId, cancellationToken).ConfigureAwait(false); + return await GetServiceApiVersionSets().GetAsync(versionSetId, cancellationToken).ConfigureAwait(false); } /// @@ -467,9 +467,62 @@ public virtual async Task> GetApiVersionSetAsync /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual Response GetApiVersionSet(string versionSetId, CancellationToken cancellationToken = default) + public virtual Response GetServiceApiVersionSet(string versionSetId, CancellationToken cancellationToken = default) { - return GetApiVersionSets().Get(versionSetId, cancellationToken); + return GetServiceApiVersionSets().Get(versionSetId, cancellationToken); + } + + /// Gets a collection of AuthorizationProviderContractResources in the ApiManagementService. + /// An object representing collection of AuthorizationProviderContractResources and their operations over a AuthorizationProviderContractResource. + public virtual AuthorizationProviderContractCollection GetAuthorizationProviderContracts() + { + return GetCachedClient(Client => new AuthorizationProviderContractCollection(Client, Id)); + } + + /// + /// Gets the details of the authorization provider specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Get + /// + /// + /// + /// Identifier of the authorization provider. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetAuthorizationProviderContractAsync(string authorizationProviderId, CancellationToken cancellationToken = default) + { + return await GetAuthorizationProviderContracts().GetAsync(authorizationProviderId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the authorization provider specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Get + /// + /// + /// + /// Identifier of the authorization provider. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetAuthorizationProviderContract(string authorizationProviderId, CancellationToken cancellationToken = default) + { + return GetAuthorizationProviderContracts().Get(authorizationProviderId, cancellationToken); } /// Gets a collection of ApiManagementAuthorizationServerResources in the ApiManagementService. @@ -684,6 +737,59 @@ public virtual Response GetApiManagementCertif return GetApiManagementCertificates().Get(certificateId, cancellationToken); } + /// Gets a collection of DocumentationContractResources in the ApiManagementService. + /// An object representing collection of DocumentationContractResources and their operations over a DocumentationContractResource. + public virtual DocumentationContractCollection GetDocumentationContracts() + { + return GetCachedClient(Client => new DocumentationContractCollection(Client, Id)); + } + + /// + /// Gets the details of the Documentation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Get + /// + /// + /// + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetDocumentationContractAsync(string documentationId, CancellationToken cancellationToken = default) + { + return await GetDocumentationContracts().GetAsync(documentationId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the Documentation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Get + /// + /// + /// + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetDocumentationContract(string documentationId, CancellationToken cancellationToken = default) + { + return GetDocumentationContracts().Get(documentationId, cancellationToken); + } + /// Gets a collection of ApiManagementEmailTemplateResources in the ApiManagementService. /// An object representing collection of ApiManagementEmailTemplateResources and their operations over a ApiManagementEmailTemplateResource. public virtual ApiManagementEmailTemplateCollection GetApiManagementEmailTemplates() @@ -786,11 +892,11 @@ public virtual Response GetApiManagementGateway(st return GetApiManagementGateways().Get(gatewayId, cancellationToken); } - /// Gets a collection of ApiManagementGroupResources in the ApiManagementService. - /// An object representing collection of ApiManagementGroupResources and their operations over a ApiManagementGroupResource. - public virtual ApiManagementGroupCollection GetApiManagementGroups() + /// Gets a collection of ServiceGroupResources in the ApiManagementService. + /// An object representing collection of ServiceGroupResources and their operations over a ServiceGroupResource. + public virtual ServiceGroupCollection GetServiceGroups() { - return GetCachedClient(Client => new ApiManagementGroupCollection(Client, Id)); + return GetCachedClient(Client => new ServiceGroupCollection(Client, Id)); } /// @@ -811,9 +917,9 @@ public virtual ApiManagementGroupCollection GetApiManagementGroups() /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual async Task> GetApiManagementGroupAsync(string groupId, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceGroupAsync(string groupId, CancellationToken cancellationToken = default) { - return await GetApiManagementGroups().GetAsync(groupId, cancellationToken).ConfigureAwait(false); + return await GetServiceGroups().GetAsync(groupId, cancellationToken).ConfigureAwait(false); } /// @@ -834,9 +940,9 @@ public virtual async Task> GetApiManagement /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual Response GetApiManagementGroup(string groupId, CancellationToken cancellationToken = default) + public virtual Response GetServiceGroup(string groupId, CancellationToken cancellationToken = default) { - return GetApiManagementGroups().Get(groupId, cancellationToken); + return GetServiceGroups().Get(groupId, cancellationToken); } /// Gets a collection of ApiManagementIdentityProviderResources in the ApiManagementService. @@ -941,11 +1047,11 @@ public virtual Response GetApiManagementLogger(stri return GetApiManagementLoggers().Get(loggerId, cancellationToken); } - /// Gets a collection of ApiManagementNamedValueResources in the ApiManagementService. - /// An object representing collection of ApiManagementNamedValueResources and their operations over a ApiManagementNamedValueResource. - public virtual ApiManagementNamedValueCollection GetApiManagementNamedValues() + /// Gets a collection of ServiceNamedValueResources in the ApiManagementService. + /// An object representing collection of ServiceNamedValueResources and their operations over a ServiceNamedValueResource. + public virtual ServiceNamedValueCollection GetServiceNamedValues() { - return GetCachedClient(Client => new ApiManagementNamedValueCollection(Client, Id)); + return GetCachedClient(Client => new ServiceNamedValueCollection(Client, Id)); } /// @@ -966,9 +1072,9 @@ public virtual ApiManagementNamedValueCollection GetApiManagementNamedValues() /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual async Task> GetApiManagementNamedValueAsync(string namedValueId, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceNamedValueAsync(string namedValueId, CancellationToken cancellationToken = default) { - return await GetApiManagementNamedValues().GetAsync(namedValueId, cancellationToken).ConfigureAwait(false); + return await GetServiceNamedValues().GetAsync(namedValueId, cancellationToken).ConfigureAwait(false); } /// @@ -989,16 +1095,16 @@ public virtual async Task> GetApiManag /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual Response GetApiManagementNamedValue(string namedValueId, CancellationToken cancellationToken = default) + public virtual Response GetServiceNamedValue(string namedValueId, CancellationToken cancellationToken = default) { - return GetApiManagementNamedValues().Get(namedValueId, cancellationToken); + return GetServiceNamedValues().Get(namedValueId, cancellationToken); } - /// Gets a collection of ApiManagementNotificationResources in the ApiManagementService. - /// An object representing collection of ApiManagementNotificationResources and their operations over a ApiManagementNotificationResource. - public virtual ApiManagementNotificationCollection GetApiManagementNotifications() + /// Gets a collection of ServiceNotificationResources in the ApiManagementService. + /// An object representing collection of ServiceNotificationResources and their operations over a ServiceNotificationResource. + public virtual ServiceNotificationCollection GetServiceNotifications() { - return GetCachedClient(Client => new ApiManagementNotificationCollection(Client, Id)); + return GetCachedClient(Client => new ServiceNotificationCollection(Client, Id)); } /// @@ -1017,9 +1123,9 @@ public virtual ApiManagementNotificationCollection GetApiManagementNotifications /// Notification Name Identifier. /// The cancellation token to use. [ForwardsClientCalls] - public virtual async Task> GetApiManagementNotificationAsync(NotificationName notificationName, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceNotificationAsync(NotificationName notificationName, CancellationToken cancellationToken = default) { - return await GetApiManagementNotifications().GetAsync(notificationName, cancellationToken).ConfigureAwait(false); + return await GetServiceNotifications().GetAsync(notificationName, cancellationToken).ConfigureAwait(false); } /// @@ -1038,9 +1144,9 @@ public virtual async Task> GetApiMan /// Notification Name Identifier. /// The cancellation token to use. [ForwardsClientCalls] - public virtual Response GetApiManagementNotification(NotificationName notificationName, CancellationToken cancellationToken = default) + public virtual Response GetServiceNotification(NotificationName notificationName, CancellationToken cancellationToken = default) { - return GetApiManagementNotifications().Get(notificationName, cancellationToken); + return GetServiceNotifications().Get(notificationName, cancellationToken); } /// Gets a collection of ApiManagementOpenIdConnectProviderResources in the ApiManagementService. @@ -1096,6 +1202,114 @@ public virtual Response GetApiManage return GetApiManagementOpenIdConnectProviders().Get(openId, cancellationToken); } + /// Gets a collection of ServicePolicyFragmentResources in the ApiManagementService. + /// An object representing collection of ServicePolicyFragmentResources and their operations over a ServicePolicyFragmentResource. + public virtual ServicePolicyFragmentCollection GetServicePolicyFragments() + { + return GetCachedClient(Client => new ServicePolicyFragmentCollection(Client, Id)); + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServicePolicyFragmentAsync(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + return await GetServicePolicyFragments().GetAsync(id, format, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServicePolicyFragment(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + return GetServicePolicyFragments().Get(id, format, cancellationToken); + } + + /// Gets a collection of PortalConfigContractResources in the ApiManagementService. + /// An object representing collection of PortalConfigContractResources and their operations over a PortalConfigContractResource. + public virtual PortalConfigContractCollection GetPortalConfigContracts() + { + return GetCachedClient(Client => new PortalConfigContractCollection(Client, Id)); + } + + /// + /// Get the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Get + /// + /// + /// + /// Portal configuration identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetPortalConfigContractAsync(string portalConfigId, CancellationToken cancellationToken = default) + { + return await GetPortalConfigContracts().GetAsync(portalConfigId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Get + /// + /// + /// + /// Portal configuration identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetPortalConfigContract(string portalConfigId, CancellationToken cancellationToken = default) + { + return GetPortalConfigContracts().Get(portalConfigId, cancellationToken); + } + /// Gets a collection of ApiManagementPortalRevisionResources in the ApiManagementService. /// An object representing collection of ApiManagementPortalRevisionResources and their operations over a ApiManagementPortalRevisionResource. public virtual ApiManagementPortalRevisionCollection GetApiManagementPortalRevisions() @@ -1276,11 +1490,11 @@ public virtual Response GetApiManagementPrivat return GetApiManagementPrivateLinkResources().Get(privateLinkSubResourceName, cancellationToken); } - /// Gets a collection of ApiManagementProductResources in the ApiManagementService. - /// An object representing collection of ApiManagementProductResources and their operations over a ApiManagementProductResource. - public virtual ApiManagementProductCollection GetApiManagementProducts() + /// Gets a collection of ServiceProductResources in the ApiManagementService. + /// An object representing collection of ServiceProductResources and their operations over a ServiceProductResource. + public virtual ServiceProductCollection GetServiceProducts() { - return GetCachedClient(Client => new ApiManagementProductCollection(Client, Id)); + return GetCachedClient(Client => new ServiceProductCollection(Client, Id)); } /// @@ -1301,9 +1515,9 @@ public virtual ApiManagementProductCollection GetApiManagementProducts() /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual async Task> GetApiManagementProductAsync(string productId, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceProductAsync(string productId, CancellationToken cancellationToken = default) { - return await GetApiManagementProducts().GetAsync(productId, cancellationToken).ConfigureAwait(false); + return await GetServiceProducts().GetAsync(productId, cancellationToken).ConfigureAwait(false); } /// @@ -1324,16 +1538,16 @@ public virtual async Task> GetApiManageme /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual Response GetApiManagementProduct(string productId, CancellationToken cancellationToken = default) + public virtual Response GetServiceProduct(string productId, CancellationToken cancellationToken = default) { - return GetApiManagementProducts().Get(productId, cancellationToken); + return GetServiceProducts().Get(productId, cancellationToken); } - /// Gets a collection of ApiManagementGlobalSchemaResources in the ApiManagementService. - /// An object representing collection of ApiManagementGlobalSchemaResources and their operations over a ApiManagementGlobalSchemaResource. - public virtual ApiManagementGlobalSchemaCollection GetApiManagementGlobalSchemas() + /// Gets a collection of ServiceSchemaResources in the ApiManagementService. + /// An object representing collection of ServiceSchemaResources and their operations over a ServiceSchemaResource. + public virtual ServiceSchemaCollection GetServiceSchemas() { - return GetCachedClient(Client => new ApiManagementGlobalSchemaCollection(Client, Id)); + return GetCachedClient(Client => new ServiceSchemaCollection(Client, Id)); } /// @@ -1354,9 +1568,9 @@ public virtual ApiManagementGlobalSchemaCollection GetApiManagementGlobalSchemas /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual async Task> GetApiManagementGlobalSchemaAsync(string schemaId, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceSchemaAsync(string schemaId, CancellationToken cancellationToken = default) { - return await GetApiManagementGlobalSchemas().GetAsync(schemaId, cancellationToken).ConfigureAwait(false); + return await GetServiceSchemas().GetAsync(schemaId, cancellationToken).ConfigureAwait(false); } /// @@ -1377,9 +1591,9 @@ public virtual async Task> GetApiMan /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual Response GetApiManagementGlobalSchema(string schemaId, CancellationToken cancellationToken = default) + public virtual Response GetServiceSchema(string schemaId, CancellationToken cancellationToken = default) { - return GetApiManagementGlobalSchemas().Get(schemaId, cancellationToken); + return GetServiceSchemas().Get(schemaId, cancellationToken); } /// Gets a collection of ApiManagementTenantSettingResources in the ApiManagementService. @@ -1586,6 +1800,59 @@ public virtual Response GetApiManagementUser(string u return GetApiManagementUsers().Get(userId, cancellationToken); } + /// Gets a collection of WorkspaceContractResources in the ApiManagementService. + /// An object representing collection of WorkspaceContractResources and their operations over a WorkspaceContractResource. + public virtual WorkspaceContractCollection GetWorkspaceContracts() + { + return GetCachedClient(Client => new WorkspaceContractCollection(Client, Id)); + } + + /// + /// Gets the details of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Get + /// + /// + /// + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetWorkspaceContractAsync(string workspaceId, CancellationToken cancellationToken = default) + { + return await GetWorkspaceContracts().GetAsync(workspaceId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Get + /// + /// + /// + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetWorkspaceContract(string workspaceId, CancellationToken cancellationToken = default) + { + return GetWorkspaceContracts().Get(workspaceId, cancellationToken); + } + /// /// Gets an API Management service resource description. /// @@ -1815,9 +2082,9 @@ public virtual ArmOperation Update(WaitUntil waitU /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetApisByTagsAsync(string filter = null, int? top = null, int? skip = null, bool? includeNotTaggedApis = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedApis); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedApis); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _apiClientDiagnostics, Pipeline, "ApiManagementServiceResource.GetApisByTags", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiApiRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedApis); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiApiRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedApis); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _serviceApiApiClientDiagnostics, Pipeline, "ApiManagementServiceResource.GetApisByTags", "value", "nextLink", cancellationToken); } /// @@ -1841,9 +2108,9 @@ public virtual AsyncPageable GetApisByTagsAsync(stri /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetApisByTags(string filter = null, int? top = null, int? skip = null, bool? includeNotTaggedApis = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedApis); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedApis); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _apiClientDiagnostics, Pipeline, "ApiManagementServiceResource.GetApisByTags", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiApiRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedApis); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiApiRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedApis); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _serviceApiApiClientDiagnostics, Pipeline, "ApiManagementServiceResource.GetApisByTags", "value", "nextLink", cancellationToken); } /// @@ -2050,19 +2317,21 @@ public virtual Response GetContentType(string contentT /// /// /// Content type identifier. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> CreateOrUpdateContentTypeAsync(string contentTypeId, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> CreateOrUpdateContentTypeAsync(string contentTypeId, ApiManagementContentType apiManagementContentType, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(contentTypeId, nameof(contentTypeId)); + Argument.AssertNotNull(apiManagementContentType, nameof(apiManagementContentType)); using var scope = _contentTypeClientDiagnostics.CreateScope("ApiManagementServiceResource.CreateOrUpdateContentType"); scope.Start(); try { - var response = await _contentTypeRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contentTypeId, ifMatch, cancellationToken).ConfigureAwait(false); + var response = await _contentTypeRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contentTypeId, apiManagementContentType, ifMatch, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -2086,19 +2355,21 @@ public virtual async Task> CreateOrUpdateCont /// /// /// Content type identifier. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response CreateOrUpdateContentType(string contentTypeId, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual Response CreateOrUpdateContentType(string contentTypeId, ApiManagementContentType apiManagementContentType, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(contentTypeId, nameof(contentTypeId)); + Argument.AssertNotNull(apiManagementContentType, nameof(apiManagementContentType)); using var scope = _contentTypeClientDiagnostics.CreateScope("ApiManagementServiceResource.CreateOrUpdateContentType"); scope.Start(); try { - var response = _contentTypeRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contentTypeId, ifMatch, cancellationToken); + var response = _contentTypeRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contentTypeId, apiManagementContentType, ifMatch, cancellationToken); return response; } catch (Exception e) @@ -2397,20 +2668,22 @@ public virtual Response GetContentItem(string contentT /// /// Content type identifier. /// Content item identifier. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// or is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateContentItemAsync(string contentTypeId, string contentItemId, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// , or is null. + public virtual async Task> CreateOrUpdateContentItemAsync(string contentTypeId, string contentItemId, ApiManagementContentItem apiManagementContentItem, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(contentTypeId, nameof(contentTypeId)); Argument.AssertNotNullOrEmpty(contentItemId, nameof(contentItemId)); + Argument.AssertNotNull(apiManagementContentItem, nameof(apiManagementContentItem)); using var scope = _contentItemClientDiagnostics.CreateScope("ApiManagementServiceResource.CreateOrUpdateContentItem"); scope.Start(); try { - var response = await _contentItemRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contentTypeId, contentItemId, ifMatch, cancellationToken).ConfigureAwait(false); + var response = await _contentItemRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contentTypeId, contentItemId, apiManagementContentItem, ifMatch, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -2435,20 +2708,22 @@ public virtual async Task> CreateOrUpdateCont /// /// Content type identifier. /// Content item identifier. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// or is an empty string, and was expected to be non-empty. - /// or is null. - public virtual Response CreateOrUpdateContentItem(string contentTypeId, string contentItemId, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// , or is null. + public virtual Response CreateOrUpdateContentItem(string contentTypeId, string contentItemId, ApiManagementContentItem apiManagementContentItem, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(contentTypeId, nameof(contentTypeId)); Argument.AssertNotNullOrEmpty(contentItemId, nameof(contentItemId)); + Argument.AssertNotNull(apiManagementContentItem, nameof(apiManagementContentItem)); using var scope = _contentItemClientDiagnostics.CreateScope("ApiManagementServiceResource.CreateOrUpdateContentItem"); scope.Start(); try { - var response = _contentItemRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contentTypeId, contentItemId, ifMatch, cancellationToken); + var response = _contentItemRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, contentTypeId, contentItemId, apiManagementContentItem, ifMatch, cancellationToken); return response; } catch (Exception e) @@ -2730,6 +3005,74 @@ public virtual ArmOperation Backup(WaitUntil waitU } } + /// + /// 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. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/migrateToStv2 + /// + /// + /// Operation Id + /// ApiManagementService_MigrateToStv2 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task> MigrateToStv2Async(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _apiManagementServiceClientDiagnostics.CreateScope("ApiManagementServiceResource.MigrateToStv2"); + scope.Start(); + try + { + var response = await _apiManagementServiceRestClient.MigrateToStv2Async(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ApiManagementServiceOperationSource(Client), _apiManagementServiceClientDiagnostics, Pipeline, _apiManagementServiceRestClient.CreateMigrateToStv2Request(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// 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. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/migrateToStv2 + /// + /// + /// Operation Id + /// ApiManagementService_MigrateToStv2 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation MigrateToStv2(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _apiManagementServiceClientDiagnostics.CreateScope("ApiManagementServiceResource.MigrateToStv2"); + scope.Start(); + try + { + var response = _apiManagementServiceRestClient.MigrateToStv2(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(new ApiManagementServiceOperationSource(Client), _apiManagementServiceClientDiagnostics, Pipeline, _apiManagementServiceRestClient.CreateMigrateToStv2Request(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes. /// @@ -3113,9 +3456,9 @@ public virtual Pageable GetPortalSettings(Cancellati /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetProductsByTagsAsync(string filter = null, int? top = null, int? skip = null, bool? includeNotTaggedProducts = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementProductProductRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedProducts); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementProductProductRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedProducts); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _apiManagementProductProductClientDiagnostics, Pipeline, "ApiManagementServiceResource.GetProductsByTags", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceProductProductRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedProducts); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceProductProductRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedProducts); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _serviceProductProductClientDiagnostics, Pipeline, "ApiManagementServiceResource.GetProductsByTags", "value", "nextLink", cancellationToken); } /// @@ -3139,9 +3482,9 @@ public virtual AsyncPageable GetProductsByTagsAsync( /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetProductsByTags(string filter = null, int? top = null, int? skip = null, bool? includeNotTaggedProducts = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementProductProductRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedProducts); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementProductProductRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedProducts); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _apiManagementProductProductClientDiagnostics, Pipeline, "ApiManagementServiceResource.GetProductsByTags", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceProductProductRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedProducts); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceProductProductRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, includeNotTaggedProducts); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _serviceProductProductClientDiagnostics, Pipeline, "ApiManagementServiceResource.GetProductsByTags", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionCollection.cs index 0cb80d8f88c5..cb90d379550c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionCollection.cs @@ -68,7 +68,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. - /// Create parameters. + /// Create parameters. /// /// Notify change in Subscription State. /// - If false, do not send any email notification for change of state of subscription @@ -78,17 +78,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// Determines the type of application which send the create user request. Default is legacy publisher portal. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string sid, ApiManagementSubscriptionCreateOrUpdateContent content, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(sid, nameof(sid)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(subscriptionCreateParameters, nameof(subscriptionCreateParameters)); using var scope = _apiManagementSubscriptionSubscriptionClientDiagnostics.CreateScope("ApiManagementSubscriptionCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiManagementSubscriptionSubscriptionRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sid, content, notify, ifMatch, appType, cancellationToken).ConfigureAwait(false); + var response = await _apiManagementSubscriptionSubscriptionRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sid, subscriptionCreateParameters, notify, ifMatch, appType, cancellationToken).ConfigureAwait(false); var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementSubscriptionResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); @@ -116,7 +116,7 @@ public virtual async Task> Creat /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. - /// Create parameters. + /// Create parameters. /// /// Notify change in Subscription State. /// - If false, do not send any email notification for change of state of subscription @@ -126,17 +126,17 @@ public virtual async Task> Creat /// Determines the type of application which send the create user request. Default is legacy publisher portal. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string sid, ApiManagementSubscriptionCreateOrUpdateContent content, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(sid, nameof(sid)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(subscriptionCreateParameters, nameof(subscriptionCreateParameters)); using var scope = _apiManagementSubscriptionSubscriptionClientDiagnostics.CreateScope("ApiManagementSubscriptionCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiManagementSubscriptionSubscriptionRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sid, content, notify, ifMatch, appType, cancellationToken); + var response = _apiManagementSubscriptionSubscriptionRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sid, subscriptionCreateParameters, notify, ifMatch, appType, cancellationToken); var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementSubscriptionResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionResource.cs index 1fe8395815e0..389a5bc48478 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionResource.cs @@ -235,7 +235,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, Cancellati /// /// /// 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. - /// Update parameters. + /// Update parameters. /// /// Notify change in Subscription State. /// - If false, do not send any email notification for change of state of subscription @@ -243,16 +243,16 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, Cancellati /// /// Determines the type of application which send the create user request. Default is legacy publisher portal. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(ETag ifMatch, ApiManagementSubscriptionPatch patch, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(subscriptionUpdateParameters, nameof(subscriptionUpdateParameters)); using var scope = _apiManagementSubscriptionSubscriptionClientDiagnostics.CreateScope("ApiManagementSubscriptionResource.Update"); scope.Start(); try { - var response = await _apiManagementSubscriptionSubscriptionRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, notify, appType, cancellationToken).ConfigureAwait(false); + var response = await _apiManagementSubscriptionSubscriptionRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, subscriptionUpdateParameters, notify, appType, cancellationToken).ConfigureAwait(false); return Response.FromValue(new ApiManagementSubscriptionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -276,7 +276,7 @@ public virtual async Task> UpdateAsy /// /// /// 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. - /// Update parameters. + /// Update parameters. /// /// Notify change in Subscription State. /// - If false, do not send any email notification for change of state of subscription @@ -284,16 +284,16 @@ public virtual async Task> UpdateAsy /// /// Determines the type of application which send the create user request. Default is legacy publisher portal. /// The cancellation token to use. - /// is null. - public virtual Response Update(ETag ifMatch, ApiManagementSubscriptionPatch patch, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(subscriptionUpdateParameters, nameof(subscriptionUpdateParameters)); using var scope = _apiManagementSubscriptionSubscriptionClientDiagnostics.CreateScope("ApiManagementSubscriptionResource.Update"); scope.Start(); try { - var response = _apiManagementSubscriptionSubscriptionRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, notify, appType, cancellationToken); + var response = _apiManagementSubscriptionSubscriptionRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, subscriptionUpdateParameters, notify, appType, cancellationToken); return Response.FromValue(new ApiManagementSubscriptionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagResource.cs index c61139dda16b..a646c3dcdfe0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagResource.cs @@ -87,6 +87,165 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } + /// Gets a collection of ServiceTagApiLinkResources in the ApiManagementTag. + /// An object representing collection of ServiceTagApiLinkResources and their operations over a ServiceTagApiLinkResource. + public virtual ServiceTagApiLinkCollection GetServiceTagApiLinks() + { + return GetCachedClient(Client => new ServiceTagApiLinkCollection(Client, Id)); + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceTagApiLinkAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceTagApiLinks().GetAsync(apiLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceTagApiLink(string apiLinkId, CancellationToken cancellationToken = default) + { + return GetServiceTagApiLinks().Get(apiLinkId, cancellationToken); + } + + /// Gets a collection of ServiceTagOperationLinkResources in the ApiManagementTag. + /// An object representing collection of ServiceTagOperationLinkResources and their operations over a ServiceTagOperationLinkResource. + public virtual ServiceTagOperationLinkCollection GetServiceTagOperationLinks() + { + return GetCachedClient(Client => new ServiceTagOperationLinkCollection(Client, Id)); + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceTagOperationLinkAsync(string operationLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceTagOperationLinks().GetAsync(operationLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceTagOperationLink(string operationLinkId, CancellationToken cancellationToken = default) + { + return GetServiceTagOperationLinks().Get(operationLinkId, cancellationToken); + } + + /// Gets a collection of ServiceTagProductLinkResources in the ApiManagementTag. + /// An object representing collection of ServiceTagProductLinkResources and their operations over a ServiceTagProductLinkResource. + public virtual ServiceTagProductLinkCollection GetServiceTagProductLinks() + { + return GetCachedClient(Client => new ServiceTagProductLinkCollection(Client, Id)); + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceTagProductLinkAsync(string productLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceTagProductLinks().GetAsync(productLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceTagProductLink(string productLinkId, CancellationToken cancellationToken = default) + { + return GetServiceTagProductLinks().Get(productLinkId, cancellationToken); + } + /// /// Gets the details of the tag specified by its identifier. /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserResource.cs index b34ca80398d5..cf7448f602b7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserResource.cs @@ -507,12 +507,12 @@ public virtual Response GetSharedAccessToken(UserTokenContent c /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUserGroupsAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUserGroupsAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _userGroupRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _userGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _userGroupClientDiagnostics, Pipeline, "ApiManagementUserResource.GetUserGroups", "value", "nextLink", cancellationToken); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApiManagementGroupData.DeserializeApiManagementGroupData, _userGroupClientDiagnostics, Pipeline, "ApiManagementUserResource.GetUserGroups", "value", "nextLink", cancellationToken); } /// @@ -532,12 +532,12 @@ public virtual AsyncPageable GetUserGroupsAsync(stri /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUserGroups(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUserGroups(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _userGroupRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _userGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _userGroupClientDiagnostics, Pipeline, "ApiManagementUserResource.GetUserGroups", "value", "nextLink", cancellationToken); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApiManagementGroupData.DeserializeApiManagementGroupData, _userGroupClientDiagnostics, Pipeline, "ApiManagementUserResource.GetUserGroups", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyCollection.cs index 9e60f0898c36..8ef96f975c83 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyCollection.cs @@ -21,8 +21,8 @@ namespace Azure.ResourceManager.ApiManagement { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiOperationPolicies method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetApiOperationPolicies method from an instance of . /// public partial class ApiOperationPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -49,8 +49,8 @@ internal ApiOperationPolicyCollection(ArmClient client, ResourceIdentifier id) : internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiOperationResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiOperationResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiOperationResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiOperationResource.ResourceType), nameof(id)); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyResource.cs index 0be4a2063124..9c8a9b23cc19 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyResource.cs @@ -21,7 +21,7 @@ namespace Azure.ResourceManager.ApiManagement /// A Class representing an ApiOperationPolicy along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetApiOperationPolicyResource method. - /// Otherwise you can get one from its parent resource using the GetApiOperationPolicy method. + /// Otherwise you can get one from its parent resource using the GetApiOperationPolicy method. /// public partial class ApiOperationPolicyResource : ArmResource { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagCollection.cs index e81cd32fb8e0..051aa10933cc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagCollection.cs @@ -20,8 +20,8 @@ namespace Azure.ResourceManager.ApiManagement { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiOperationTags method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetApiOperationTags method from an instance of . /// public partial class ApiOperationTagCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -48,8 +48,8 @@ internal ApiOperationTagCollection(ArmClient client, ResourceIdentifier id) : ba internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiOperationResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiOperationResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiOperationResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiOperationResource.ResourceType), nameof(id)); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagResource.cs index e47445d6b0eb..01c7c02e9c9a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagResource.cs @@ -20,7 +20,7 @@ namespace Azure.ResourceManager.ApiManagement /// A Class representing an ApiOperationTag along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetApiOperationTagResource method. - /// Otherwise you can get one from its parent resource using the GetApiOperationTag method. + /// Otherwise you can get one from its parent resource using the GetApiOperationTag method. /// public partial class ApiOperationTagResource : ArmResource { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyCollection.cs index 81887d277602..3ecda2f09ca0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyCollection.cs @@ -21,8 +21,8 @@ namespace Azure.ResourceManager.ApiManagement { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiPolicies method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetApiPolicies method from an instance of . /// public partial class ApiPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -49,8 +49,8 @@ internal ApiPolicyCollection(ArmClient client, ResourceIdentifier id) : base(cli internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiResource.ResourceType), nameof(id)); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyResource.cs index 668f59c6afd3..920eed8b283b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyResource.cs @@ -21,7 +21,7 @@ namespace Azure.ResourceManager.ApiManagement /// A Class representing an ApiPolicy along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetApiPolicyResource method. - /// Otherwise you can get one from its parent resource using the GetApiPolicy method. + /// Otherwise you can get one from its parent resource using the GetApiPolicy method. /// public partial class ApiPolicyResource : ArmResource { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagCollection.cs index 0fdad507e08a..23c28b2bba79 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagCollection.cs @@ -20,8 +20,8 @@ namespace Azure.ResourceManager.ApiManagement { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiTags method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetApiTags method from an instance of . /// public partial class ApiTagCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -48,8 +48,8 @@ internal ApiTagCollection(ArmClient client, ResourceIdentifier id) : base(client internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiResource.ResourceType), nameof(id)); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionCollection.cs index c9a44a8a922a..701236831686 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionCollection.cs @@ -21,8 +21,8 @@ namespace Azure.ResourceManager.ApiManagement { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiTagDescriptions method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetApiTagDescriptions method from an instance of . /// public partial class ApiTagDescriptionCollection : ArmCollection, IEnumerable, IAsyncEnumerable { @@ -49,8 +49,8 @@ internal ApiTagDescriptionCollection(ArmClient client, ResourceIdentifier id) : internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiResource.ResourceType), nameof(id)); } /// diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionResource.cs index ac20bc7195d8..0e8f61ff494e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionResource.cs @@ -21,7 +21,7 @@ namespace Azure.ResourceManager.ApiManagement /// A Class representing an ApiTagDescription along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetApiTagDescriptionResource method. - /// Otherwise you can get one from its parent resource using the GetApiTagDescription method. + /// Otherwise you can get one from its parent resource using the GetApiTagDescription method. /// public partial class ApiTagDescriptionResource : ArmResource { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagResource.cs index b927e9cbbcab..f3b01a683607 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagResource.cs @@ -20,7 +20,7 @@ namespace Azure.ResourceManager.ApiManagement /// A Class representing an ApiTag along with the instance operations that can be performed on it. /// If you have a you can construct an /// from an instance of using the GetApiTagResource method. - /// Otherwise you can get one from its parent resource using the GetApiTag method. + /// Otherwise you can get one from its parent resource using the GetApiTag method. /// public partial class ApiTagResource : ArmResource { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationAccessPolicyContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationAccessPolicyContractCollection.cs new file mode 100644 index 000000000000..ab234f8b2d4e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationAccessPolicyContractCollection.cs @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetAuthorizationAccessPolicyContracts method from an instance of . + /// + public partial class AuthorizationAccessPolicyContractCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics; + private readonly AuthorizationAccessPolicyRestOperations _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient; + + /// Initializes a new instance of the class for mocking. + protected AuthorizationAccessPolicyContractCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal AuthorizationAccessPolicyContractCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", AuthorizationAccessPolicyContractResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(AuthorizationAccessPolicyContractResource.ResourceType, out string authorizationAccessPolicyContractAuthorizationAccessPolicyApiVersion); + _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient = new AuthorizationAccessPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, authorizationAccessPolicyContractAuthorizationAccessPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != AuthorizationContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, AuthorizationContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates Authorization Access Policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Identifier of the authorization access policy. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string authorizationAccessPolicyId, AuthorizationAccessPolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationAccessPolicyId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationAccessPolicyContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates Authorization Access Policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Identifier of the authorization access policy. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string authorizationAccessPolicyId, AuthorizationAccessPolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationAccessPolicyId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationAccessPolicyContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the authorization access policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Get + /// + /// + /// + /// Identifier of the authorization access policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string authorizationAccessPolicyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractCollection.Get"); + scope.Start(); + try + { + var response = await _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationAccessPolicyId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationAccessPolicyContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the authorization access policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Get + /// + /// + /// + /// Identifier of the authorization access policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string authorizationAccessPolicyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractCollection.Get"); + scope.Start(); + try + { + var response = _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationAccessPolicyId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationAccessPolicyContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of authorization access policy defined within a authorization. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_ListByAuthorization + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.CreateListByAuthorizationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.CreateListByAuthorizationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AuthorizationAccessPolicyContractResource(Client, AuthorizationAccessPolicyContractData.DeserializeAuthorizationAccessPolicyContractData(e)), _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics, Pipeline, "AuthorizationAccessPolicyContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of authorization access policy defined within a authorization. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_ListByAuthorization + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.CreateListByAuthorizationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.CreateListByAuthorizationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AuthorizationAccessPolicyContractResource(Client, AuthorizationAccessPolicyContractData.DeserializeAuthorizationAccessPolicyContractData(e)), _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics, Pipeline, "AuthorizationAccessPolicyContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Get + /// + /// + /// + /// Identifier of the authorization access policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string authorizationAccessPolicyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractCollection.Exists"); + scope.Start(); + try + { + var response = await _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationAccessPolicyId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Get + /// + /// + /// + /// Identifier of the authorization access policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string authorizationAccessPolicyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractCollection.Exists"); + scope.Start(); + try + { + var response = _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationAccessPolicyId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationAccessPolicyContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationAccessPolicyContractData.cs new file mode 100644 index 000000000000..f7e745f4e1f5 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationAccessPolicyContractData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the AuthorizationAccessPolicyContract data model. + /// Authorization access policy contract. + /// + public partial class AuthorizationAccessPolicyContractData : ResourceData + { + /// Initializes a new instance of AuthorizationAccessPolicyContractData. + public AuthorizationAccessPolicyContractData() + { + } + + /// Initializes a new instance of AuthorizationAccessPolicyContractData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The Tenant Id. + /// The Object Id. + internal AuthorizationAccessPolicyContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Guid? tenantId, string objectId) : base(id, name, resourceType, systemData) + { + TenantId = tenantId; + ObjectId = objectId; + } + + /// The Tenant Id. + public Guid? TenantId { get; set; } + /// The Object Id. + public string ObjectId { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationAccessPolicyContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationAccessPolicyContractResource.cs new file mode 100644 index 000000000000..f1622f47a36d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationAccessPolicyContractResource.cs @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing an AuthorizationAccessPolicyContract along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetAuthorizationAccessPolicyContractResource method. + /// Otherwise you can get one from its parent resource using the GetAuthorizationAccessPolicyContract method. + /// + public partial class AuthorizationAccessPolicyContractResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics; + private readonly AuthorizationAccessPolicyRestOperations _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient; + private readonly AuthorizationAccessPolicyContractData _data; + + /// Initializes a new instance of the class for mocking. + protected AuthorizationAccessPolicyContractResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal AuthorizationAccessPolicyContractResource(ArmClient client, AuthorizationAccessPolicyContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal AuthorizationAccessPolicyContractResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string authorizationAccessPolicyContractAuthorizationAccessPolicyApiVersion); + _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient = new AuthorizationAccessPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, authorizationAccessPolicyContractAuthorizationAccessPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/authorizationProviders/authorizations/accessPolicies"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual AuthorizationAccessPolicyContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the authorization access policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractResource.Get"); + scope.Start(); + try + { + var response = await _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationAccessPolicyContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the authorization access policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractResource.Get"); + scope.Start(); + try + { + var response = _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationAccessPolicyContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific access policy from the Authorization. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractResource.Delete"); + scope.Start(); + try + { + var response = await _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific access policy from the Authorization. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractResource.Delete"); + scope.Start(); + try + { + var response = _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates Authorization Access Policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, AuthorizationAccessPolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractResource.Update"); + scope.Start(); + try + { + var response = await _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationAccessPolicyContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates Authorization Access Policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, AuthorizationAccessPolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationAccessPolicyContractAuthorizationAccessPolicyClientDiagnostics.CreateScope("AuthorizationAccessPolicyContractResource.Update"); + scope.Start(); + try + { + var response = _authorizationAccessPolicyContractAuthorizationAccessPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationAccessPolicyContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationContractCollection.cs new file mode 100644 index 000000000000..7cef891e0160 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationContractCollection.cs @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetAuthorizationContracts method from an instance of . + /// + public partial class AuthorizationContractCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _authorizationContractAuthorizationClientDiagnostics; + private readonly AuthorizationRestOperations _authorizationContractAuthorizationRestClient; + + /// Initializes a new instance of the class for mocking. + protected AuthorizationContractCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal AuthorizationContractCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _authorizationContractAuthorizationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", AuthorizationContractResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(AuthorizationContractResource.ResourceType, out string authorizationContractAuthorizationApiVersion); + _authorizationContractAuthorizationRestClient = new AuthorizationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, authorizationContractAuthorizationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != AuthorizationProviderContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, AuthorizationProviderContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates authorization. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Identifier of the authorization. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string authorizationId, AuthorizationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _authorizationContractAuthorizationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates authorization. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Identifier of the authorization. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string authorizationId, AuthorizationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _authorizationContractAuthorizationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the authorization specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Get + /// + /// + /// + /// Identifier of the authorization. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string authorizationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractCollection.Get"); + scope.Start(); + try + { + var response = await _authorizationContractAuthorizationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the authorization specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Get + /// + /// + /// + /// Identifier of the authorization. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string authorizationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractCollection.Get"); + scope.Start(); + try + { + var response = _authorizationContractAuthorizationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of authorization providers defined within a authorization provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations + /// + /// + /// Operation Id + /// Authorization_ListByAuthorizationProvider + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _authorizationContractAuthorizationRestClient.CreateListByAuthorizationProviderRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _authorizationContractAuthorizationRestClient.CreateListByAuthorizationProviderNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AuthorizationContractResource(Client, AuthorizationContractData.DeserializeAuthorizationContractData(e)), _authorizationContractAuthorizationClientDiagnostics, Pipeline, "AuthorizationContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of authorization providers defined within a authorization provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations + /// + /// + /// Operation Id + /// Authorization_ListByAuthorizationProvider + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _authorizationContractAuthorizationRestClient.CreateListByAuthorizationProviderRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _authorizationContractAuthorizationRestClient.CreateListByAuthorizationProviderNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AuthorizationContractResource(Client, AuthorizationContractData.DeserializeAuthorizationContractData(e)), _authorizationContractAuthorizationClientDiagnostics, Pipeline, "AuthorizationContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Get + /// + /// + /// + /// Identifier of the authorization. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string authorizationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractCollection.Exists"); + scope.Start(); + try + { + var response = await _authorizationContractAuthorizationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Get + /// + /// + /// + /// Identifier of the authorization. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string authorizationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractCollection.Exists"); + scope.Start(); + try + { + var response = _authorizationContractAuthorizationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationContractData.cs new file mode 100644 index 000000000000..d5b912d4f27d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationContractData.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the AuthorizationContract data model. + /// Authorization contract. + /// + public partial class AuthorizationContractData : ResourceData + { + /// Initializes a new instance of AuthorizationContractData. + public AuthorizationContractData() + { + Parameters = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of AuthorizationContractData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Authorization type options. + /// OAuth2 grant type options. + /// Authorization parameters. + /// Authorization error details. + /// Status of the Authorization. + internal AuthorizationContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AuthorizationType? authorizationType, OAuth2GrantType? oAuth2GrantType, IDictionary parameters, AuthorizationError error, string status) : base(id, name, resourceType, systemData) + { + AuthorizationType = authorizationType; + OAuth2GrantType = oAuth2GrantType; + Parameters = parameters; + Error = error; + Status = status; + } + + /// Authorization type options. + public AuthorizationType? AuthorizationType { get; set; } + /// OAuth2 grant type options. + public OAuth2GrantType? OAuth2GrantType { get; set; } + /// Authorization parameters. + public IDictionary Parameters { get; } + /// Authorization error details. + public AuthorizationError Error { get; set; } + /// Status of the Authorization. + public string Status { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationContractResource.cs new file mode 100644 index 000000000000..368365144352 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationContractResource.cs @@ -0,0 +1,495 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing an AuthorizationContract along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetAuthorizationContractResource method. + /// Otherwise you can get one from its parent resource using the GetAuthorizationContract method. + /// + public partial class AuthorizationContractResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _authorizationContractAuthorizationClientDiagnostics; + private readonly AuthorizationRestOperations _authorizationContractAuthorizationRestClient; + private readonly ClientDiagnostics _authorizationLoginLinksClientDiagnostics; + private readonly AuthorizationLoginLinksRestOperations _authorizationLoginLinksRestClient; + private readonly AuthorizationContractData _data; + + /// Initializes a new instance of the class for mocking. + protected AuthorizationContractResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal AuthorizationContractResource(ArmClient client, AuthorizationContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal AuthorizationContractResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _authorizationContractAuthorizationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string authorizationContractAuthorizationApiVersion); + _authorizationContractAuthorizationRestClient = new AuthorizationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, authorizationContractAuthorizationApiVersion); + _authorizationLoginLinksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _authorizationLoginLinksRestClient = new AuthorizationLoginLinksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/authorizationProviders/authorizations"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual AuthorizationContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of AuthorizationAccessPolicyContractResources in the AuthorizationContract. + /// An object representing collection of AuthorizationAccessPolicyContractResources and their operations over a AuthorizationAccessPolicyContractResource. + public virtual AuthorizationAccessPolicyContractCollection GetAuthorizationAccessPolicyContracts() + { + return GetCachedClient(Client => new AuthorizationAccessPolicyContractCollection(Client, Id)); + } + + /// + /// Gets the details of the authorization access policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Get + /// + /// + /// + /// Identifier of the authorization access policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetAuthorizationAccessPolicyContractAsync(string authorizationAccessPolicyId, CancellationToken cancellationToken = default) + { + return await GetAuthorizationAccessPolicyContracts().GetAsync(authorizationAccessPolicyId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the authorization access policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/accessPolicies/{authorizationAccessPolicyId} + /// + /// + /// Operation Id + /// AuthorizationAccessPolicy_Get + /// + /// + /// + /// Identifier of the authorization access policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetAuthorizationAccessPolicyContract(string authorizationAccessPolicyId, CancellationToken cancellationToken = default) + { + return GetAuthorizationAccessPolicyContracts().Get(authorizationAccessPolicyId, cancellationToken); + } + + /// + /// Gets the details of the authorization specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractResource.Get"); + scope.Start(); + try + { + var response = await _authorizationContractAuthorizationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the authorization specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractResource.Get"); + scope.Start(); + try + { + var response = _authorizationContractAuthorizationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific Authorization from the Authorization provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractResource.Delete"); + scope.Start(); + try + { + var response = await _authorizationContractAuthorizationRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific Authorization from the Authorization provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractResource.Delete"); + scope.Start(); + try + { + var response = _authorizationContractAuthorizationRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates authorization. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, AuthorizationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractResource.Update"); + scope.Start(); + try + { + var response = await _authorizationContractAuthorizationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates authorization. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, AuthorizationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractResource.Update"); + scope.Start(); + try + { + var response = _authorizationContractAuthorizationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Confirm valid consent code to suppress Authorizations anti-phishing page. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/confirmConsentCode + /// + /// + /// Operation Id + /// Authorization_ConfirmConsentCode + /// + /// + /// + /// Create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task ConfirmConsentCodeAsync(AuthorizationConfirmConsentCodeRequestContract authorizationConfirmConsentCodeRequestContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(authorizationConfirmConsentCodeRequestContract, nameof(authorizationConfirmConsentCodeRequestContract)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractResource.ConfirmConsentCode"); + scope.Start(); + try + { + var response = await _authorizationContractAuthorizationRestClient.ConfirmConsentCodeAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationConfirmConsentCodeRequestContract, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Confirm valid consent code to suppress Authorizations anti-phishing page. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/confirmConsentCode + /// + /// + /// Operation Id + /// Authorization_ConfirmConsentCode + /// + /// + /// + /// Create parameters. + /// The cancellation token to use. + /// is null. + public virtual Response ConfirmConsentCode(AuthorizationConfirmConsentCodeRequestContract authorizationConfirmConsentCodeRequestContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(authorizationConfirmConsentCodeRequestContract, nameof(authorizationConfirmConsentCodeRequestContract)); + + using var scope = _authorizationContractAuthorizationClientDiagnostics.CreateScope("AuthorizationContractResource.ConfirmConsentCode"); + scope.Start(); + try + { + var response = _authorizationContractAuthorizationRestClient.ConfirmConsentCode(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationConfirmConsentCodeRequestContract, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets authorization login links. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/getLoginLinks + /// + /// + /// Operation Id + /// AuthorizationLoginLinks_Post + /// + /// + /// + /// Create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> PostAuthorizationLoginLinkAsync(AuthorizationLoginRequestContract authorizationLoginRequestContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(authorizationLoginRequestContract, nameof(authorizationLoginRequestContract)); + + using var scope = _authorizationLoginLinksClientDiagnostics.CreateScope("AuthorizationContractResource.PostAuthorizationLoginLink"); + scope.Start(); + try + { + var response = await _authorizationLoginLinksRestClient.PostAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationLoginRequestContract, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets authorization login links. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId}/getLoginLinks + /// + /// + /// Operation Id + /// AuthorizationLoginLinks_Post + /// + /// + /// + /// Create parameters. + /// The cancellation token to use. + /// is null. + public virtual Response PostAuthorizationLoginLink(AuthorizationLoginRequestContract authorizationLoginRequestContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(authorizationLoginRequestContract, nameof(authorizationLoginRequestContract)); + + using var scope = _authorizationLoginLinksClientDiagnostics.CreateScope("AuthorizationContractResource.PostAuthorizationLoginLink"); + scope.Start(); + try + { + var response = _authorizationLoginLinksRestClient.Post(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, authorizationLoginRequestContract, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationProviderContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationProviderContractCollection.cs new file mode 100644 index 000000000000..75e276373754 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationProviderContractCollection.cs @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetAuthorizationProviderContracts method from an instance of . + /// + public partial class AuthorizationProviderContractCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _authorizationProviderContractAuthorizationProviderClientDiagnostics; + private readonly AuthorizationProviderRestOperations _authorizationProviderContractAuthorizationProviderRestClient; + + /// Initializes a new instance of the class for mocking. + protected AuthorizationProviderContractCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal AuthorizationProviderContractCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _authorizationProviderContractAuthorizationProviderClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", AuthorizationProviderContractResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(AuthorizationProviderContractResource.ResourceType, out string authorizationProviderContractAuthorizationProviderApiVersion); + _authorizationProviderContractAuthorizationProviderRestClient = new AuthorizationProviderRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, authorizationProviderContractAuthorizationProviderApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ApiManagementServiceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementServiceResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates authorization provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Identifier of the authorization provider. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string authorizationProviderId, AuthorizationProviderContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _authorizationProviderContractAuthorizationProviderRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationProviderId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationProviderContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates authorization provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Identifier of the authorization provider. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string authorizationProviderId, AuthorizationProviderContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _authorizationProviderContractAuthorizationProviderRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationProviderId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationProviderContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the authorization provider specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Get + /// + /// + /// + /// Identifier of the authorization provider. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string authorizationProviderId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractCollection.Get"); + scope.Start(); + try + { + var response = await _authorizationProviderContractAuthorizationProviderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationProviderId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationProviderContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the authorization provider specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Get + /// + /// + /// + /// Identifier of the authorization provider. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string authorizationProviderId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractCollection.Get"); + scope.Start(); + try + { + var response = _authorizationProviderContractAuthorizationProviderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationProviderId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationProviderContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of authorization providers defined within a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders + /// + /// + /// Operation Id + /// AuthorizationProvider_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _authorizationProviderContractAuthorizationProviderRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _authorizationProviderContractAuthorizationProviderRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AuthorizationProviderContractResource(Client, AuthorizationProviderContractData.DeserializeAuthorizationProviderContractData(e)), _authorizationProviderContractAuthorizationProviderClientDiagnostics, Pipeline, "AuthorizationProviderContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of authorization providers defined within a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders + /// + /// + /// Operation Id + /// AuthorizationProvider_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _authorizationProviderContractAuthorizationProviderRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _authorizationProviderContractAuthorizationProviderRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AuthorizationProviderContractResource(Client, AuthorizationProviderContractData.DeserializeAuthorizationProviderContractData(e)), _authorizationProviderContractAuthorizationProviderClientDiagnostics, Pipeline, "AuthorizationProviderContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Get + /// + /// + /// + /// Identifier of the authorization provider. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string authorizationProviderId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractCollection.Exists"); + scope.Start(); + try + { + var response = await _authorizationProviderContractAuthorizationProviderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationProviderId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Get + /// + /// + /// + /// Identifier of the authorization provider. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string authorizationProviderId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractCollection.Exists"); + scope.Start(); + try + { + var response = _authorizationProviderContractAuthorizationProviderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationProviderId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationProviderContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationProviderContractData.cs new file mode 100644 index 000000000000..8e72826c6263 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationProviderContractData.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the AuthorizationProviderContract data model. + /// Authorization Provider contract. + /// + public partial class AuthorizationProviderContractData : ResourceData + { + /// Initializes a new instance of AuthorizationProviderContractData. + public AuthorizationProviderContractData() + { + } + + /// Initializes a new instance of AuthorizationProviderContractData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Authorization Provider name. Must be 1 to 300 characters long. + /// Identity provider name. Must be 1 to 300 characters long. + /// OAuth2 settings. + internal AuthorizationProviderContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string identityProvider, AuthorizationProviderOAuth2Settings oauth2) : base(id, name, resourceType, systemData) + { + DisplayName = displayName; + IdentityProvider = identityProvider; + Oauth2 = oauth2; + } + + /// Authorization Provider name. Must be 1 to 300 characters long. + public string DisplayName { get; set; } + /// Identity provider name. Must be 1 to 300 characters long. + public string IdentityProvider { get; set; } + /// OAuth2 settings. + public AuthorizationProviderOAuth2Settings Oauth2 { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationProviderContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationProviderContractResource.cs new file mode 100644 index 000000000000..800d08af29af --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/AuthorizationProviderContractResource.cs @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing an AuthorizationProviderContract along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetAuthorizationProviderContractResource method. + /// Otherwise you can get one from its parent resource using the GetAuthorizationProviderContract method. + /// + public partial class AuthorizationProviderContractResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _authorizationProviderContractAuthorizationProviderClientDiagnostics; + private readonly AuthorizationProviderRestOperations _authorizationProviderContractAuthorizationProviderRestClient; + private readonly AuthorizationProviderContractData _data; + + /// Initializes a new instance of the class for mocking. + protected AuthorizationProviderContractResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal AuthorizationProviderContractResource(ArmClient client, AuthorizationProviderContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal AuthorizationProviderContractResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _authorizationProviderContractAuthorizationProviderClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string authorizationProviderContractAuthorizationProviderApiVersion); + _authorizationProviderContractAuthorizationProviderRestClient = new AuthorizationProviderRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, authorizationProviderContractAuthorizationProviderApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/authorizationProviders"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual AuthorizationProviderContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of AuthorizationContractResources in the AuthorizationProviderContract. + /// An object representing collection of AuthorizationContractResources and their operations over a AuthorizationContractResource. + public virtual AuthorizationContractCollection GetAuthorizationContracts() + { + return GetCachedClient(Client => new AuthorizationContractCollection(Client, Id)); + } + + /// + /// Gets the details of the authorization specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Get + /// + /// + /// + /// Identifier of the authorization. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetAuthorizationContractAsync(string authorizationId, CancellationToken cancellationToken = default) + { + return await GetAuthorizationContracts().GetAsync(authorizationId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the authorization specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId}/authorizations/{authorizationId} + /// + /// + /// Operation Id + /// Authorization_Get + /// + /// + /// + /// Identifier of the authorization. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetAuthorizationContract(string authorizationId, CancellationToken cancellationToken = default) + { + return GetAuthorizationContracts().Get(authorizationId, cancellationToken); + } + + /// + /// Gets the details of the authorization provider specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractResource.Get"); + scope.Start(); + try + { + var response = await _authorizationProviderContractAuthorizationProviderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationProviderContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the authorization provider specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractResource.Get"); + scope.Start(); + try + { + var response = _authorizationProviderContractAuthorizationProviderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthorizationProviderContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific authorization provider from the API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractResource.Delete"); + scope.Start(); + try + { + var response = await _authorizationProviderContractAuthorizationProviderRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific authorization provider from the API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractResource.Delete"); + scope.Start(); + try + { + var response = _authorizationProviderContractAuthorizationProviderRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates authorization provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, AuthorizationProviderContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractResource.Update"); + scope.Start(); + try + { + var response = await _authorizationProviderContractAuthorizationProviderRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationProviderContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates authorization provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationProviders/{authorizationProviderId} + /// + /// + /// Operation Id + /// AuthorizationProvider_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, AuthorizationProviderContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authorizationProviderContractAuthorizationProviderClientDiagnostics.CreateScope("AuthorizationProviderContractResource.Update"); + scope.Start(); + try + { + var response = _authorizationProviderContractAuthorizationProviderRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new AuthorizationProviderContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DocumentationContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DocumentationContractCollection.cs new file mode 100644 index 000000000000..097718e8e2ac --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DocumentationContractCollection.cs @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetDocumentationContracts method from an instance of . + /// + public partial class DocumentationContractCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _documentationContractDocumentationClientDiagnostics; + private readonly DocumentationRestOperations _documentationContractDocumentationRestClient; + + /// Initializes a new instance of the class for mocking. + protected DocumentationContractCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal DocumentationContractCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _documentationContractDocumentationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", DocumentationContractResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DocumentationContractResource.ResourceType, out string documentationContractDocumentationApiVersion); + _documentationContractDocumentationRestClient = new DocumentationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, documentationContractDocumentationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ApiManagementServiceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementServiceResource.ResourceType), nameof(id)); + } + + /// + /// Creates a new Documentation or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string documentationId, DocumentationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _documentationContractDocumentationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, documentationId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new DocumentationContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new Documentation or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string documentationId, DocumentationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _documentationContractDocumentationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, documentationId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new DocumentationContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Documentation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Get + /// + /// + /// + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string documentationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractCollection.Get"); + scope.Start(); + try + { + var response = await _documentationContractDocumentationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, documentationId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DocumentationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Documentation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Get + /// + /// + /// + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string documentationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractCollection.Get"); + scope.Start(); + try + { + var response = _documentationContractDocumentationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, documentationId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DocumentationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all Documentations of the API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations + /// + /// + /// Operation Id + /// Documentation_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq | contains |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _documentationContractDocumentationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _documentationContractDocumentationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DocumentationContractResource(Client, DocumentationContractData.DeserializeDocumentationContractData(e)), _documentationContractDocumentationClientDiagnostics, Pipeline, "DocumentationContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all Documentations of the API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations + /// + /// + /// Operation Id + /// Documentation_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq | contains |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _documentationContractDocumentationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _documentationContractDocumentationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DocumentationContractResource(Client, DocumentationContractData.DeserializeDocumentationContractData(e)), _documentationContractDocumentationClientDiagnostics, Pipeline, "DocumentationContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Get + /// + /// + /// + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string documentationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractCollection.Exists"); + scope.Start(); + try + { + var response = await _documentationContractDocumentationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, documentationId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Get + /// + /// + /// + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string documentationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractCollection.Exists"); + scope.Start(); + try + { + var response = _documentationContractDocumentationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, documentationId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DocumentationContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DocumentationContractData.cs new file mode 100644 index 000000000000..7d32750e81f6 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DocumentationContractData.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the DocumentationContract data model. + /// Markdown documentation details. + /// + public partial class DocumentationContractData : ResourceData + { + /// Initializes a new instance of DocumentationContractData. + public DocumentationContractData() + { + } + + /// Initializes a new instance of DocumentationContractData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// documentation title. + /// Markdown documentation content. + internal DocumentationContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string title, string content) : base(id, name, resourceType, systemData) + { + Title = title; + Content = content; + } + + /// documentation title. + public string Title { get; set; } + /// Markdown documentation content. + public string Content { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DocumentationContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DocumentationContractResource.cs new file mode 100644 index 000000000000..6a1732a45b40 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/DocumentationContractResource.cs @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a DocumentationContract along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetDocumentationContractResource method. + /// Otherwise you can get one from its parent resource using the GetDocumentationContract method. + /// + public partial class DocumentationContractResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string documentationId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _documentationContractDocumentationClientDiagnostics; + private readonly DocumentationRestOperations _documentationContractDocumentationRestClient; + private readonly DocumentationContractData _data; + + /// Initializes a new instance of the class for mocking. + protected DocumentationContractResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DocumentationContractResource(ArmClient client, DocumentationContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal DocumentationContractResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _documentationContractDocumentationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string documentationContractDocumentationApiVersion); + _documentationContractDocumentationRestClient = new DocumentationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, documentationContractDocumentationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/documentations"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual DocumentationContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the Documentation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractResource.Get"); + scope.Start(); + try + { + var response = await _documentationContractDocumentationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DocumentationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Documentation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractResource.Get"); + scope.Start(); + try + { + var response = _documentationContractDocumentationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DocumentationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified Documentation from an API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractResource.Delete"); + scope.Start(); + try + { + var response = await _documentationContractDocumentationRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified Documentation from an API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractResource.Delete"); + scope.Start(); + try + { + var response = _documentationContractDocumentationRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the Documentation for an API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Update + /// + /// + /// + /// 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. + /// Documentation Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, DocumentationContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractResource.Update"); + scope.Start(); + try + { + var response = await _documentationContractDocumentationRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DocumentationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the Documentation for an API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_Update + /// + /// + /// + /// 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. + /// Documentation Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, DocumentationContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractResource.Update"); + scope.Start(); + try + { + var response = _documentationContractDocumentationRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken); + return Response.FromValue(new DocumentationContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Documentation by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _documentationContractDocumentationRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Documentation by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/documentations/{documentationId} + /// + /// + /// Operation Id + /// Documentation_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _documentationContractDocumentationClientDiagnostics.CreateScope("DocumentationContractResource.GetEntityTag"); + scope.Start(); + try + { + var response = _documentationContractDocumentationRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/ApiManagementExtensions.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/ApiManagementExtensions.cs index cbbef042984f..8034c248388c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/ApiManagementExtensions.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/ApiManagementExtensions.cs @@ -365,58 +365,115 @@ public static Response GetApiManagementService(thi return resourceGroupResource.GetApiManagementServices().Get(serviceName, cancellationToken); } - #region ApiResource + #region ServiceApiResource /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static ApiResource GetApiResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServiceApiResource GetServiceApiResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - ApiResource.ValidateResourceId(id); - return new ApiResource(client, id); + ServiceApiResource.ValidateResourceId(id); + return new ServiceApiResource(client, id); } ); } #endregion - #region ApiReleaseResource + #region ServiceWorkspaceApiResource /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static ApiReleaseResource GetApiReleaseResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServiceWorkspaceApiResource GetServiceWorkspaceApiResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - ApiReleaseResource.ValidateResourceId(id); - return new ApiReleaseResource(client, id); + ServiceWorkspaceApiResource.ValidateResourceId(id); + return new ServiceWorkspaceApiResource(client, id); } ); } #endregion - #region ApiOperationResource + #region ServiceApiReleaseResource /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static ApiOperationResource GetApiOperationResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServiceApiReleaseResource GetServiceApiReleaseResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - ApiOperationResource.ValidateResourceId(id); - return new ApiOperationResource(client, id); + ServiceApiReleaseResource.ValidateResourceId(id); + return new ServiceApiReleaseResource(client, id); + } + ); + } + #endregion + + #region ServiceWorkspaceApiReleaseResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceWorkspaceApiReleaseResource GetServiceWorkspaceApiReleaseResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceWorkspaceApiReleaseResource.ValidateResourceId(id); + return new ServiceWorkspaceApiReleaseResource(client, id); + } + ); + } + #endregion + + #region ServiceApiOperationResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceApiOperationResource GetServiceApiOperationResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceApiOperationResource.ValidateResourceId(id); + return new ServiceApiOperationResource(client, id); + } + ); + } + #endregion + + #region ServiceWorkspaceApiOperationResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceWorkspaceApiOperationResource GetServiceWorkspaceApiOperationResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceWorkspaceApiOperationResource.ValidateResourceId(id); + return new ServiceWorkspaceApiOperationResource(client, id); } ); } @@ -441,6 +498,25 @@ public static ApiOperationPolicyResource GetApiOperationPolicyResource(this ArmC } #endregion + #region ServiceApiResolverPolicyResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceApiResolverPolicyResource GetServiceApiResolverPolicyResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceApiResolverPolicyResource.ValidateResourceId(id); + return new ServiceApiResolverPolicyResource(client, id); + } + ); + } + #endregion + #region ApiPolicyResource /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. @@ -498,6 +574,82 @@ public static ApiManagementProductPolicyResource GetApiManagementProductPolicyRe } #endregion + #region ServiceWorkspacePolicyResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceWorkspacePolicyResource GetServiceWorkspacePolicyResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceWorkspacePolicyResource.ValidateResourceId(id); + return new ServiceWorkspacePolicyResource(client, id); + } + ); + } + #endregion + + #region ServiceWorkspaceApiOperationPolicyResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceWorkspaceApiOperationPolicyResource GetServiceWorkspaceApiOperationPolicyResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceWorkspaceApiOperationPolicyResource.ValidateResourceId(id); + return new ServiceWorkspaceApiOperationPolicyResource(client, id); + } + ); + } + #endregion + + #region ServiceWorkspaceApiPolicyResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceWorkspaceApiPolicyResource GetServiceWorkspaceApiPolicyResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceWorkspaceApiPolicyResource.ValidateResourceId(id); + return new ServiceWorkspaceApiPolicyResource(client, id); + } + ); + } + #endregion + + #region ServiceWorkspaceProductPolicyResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceWorkspaceProductPolicyResource GetServiceWorkspaceProductPolicyResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceWorkspaceProductPolicyResource.ValidateResourceId(id); + return new ServiceWorkspaceProductPolicyResource(client, id); + } + ); + } + #endregion + #region ApiOperationTagResource /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. @@ -574,20 +726,77 @@ public static ApiManagementTagResource GetApiManagementTagResource(this ArmClien } #endregion - #region ApiSchemaResource + #region ServiceWorkspaceTagResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceWorkspaceTagResource GetServiceWorkspaceTagResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceWorkspaceTagResource.ValidateResourceId(id); + return new ServiceWorkspaceTagResource(client, id); + } + ); + } + #endregion + + #region ResolverContractResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ResolverContractResource GetResolverContractResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ResolverContractResource.ValidateResourceId(id); + return new ResolverContractResource(client, id); + } + ); + } + #endregion + + #region ServiceApiSchemaResource /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static ApiSchemaResource GetApiSchemaResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServiceApiSchemaResource GetServiceApiSchemaResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - ApiSchemaResource.ValidateResourceId(id); - return new ApiSchemaResource(client, id); + ServiceApiSchemaResource.ValidateResourceId(id); + return new ServiceApiSchemaResource(client, id); + } + ); + } + #endregion + + #region ServiceWorkspaceApiSchemaResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceWorkspaceApiSchemaResource GetServiceWorkspaceApiSchemaResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceWorkspaceApiSchemaResource.ValidateResourceId(id); + return new ServiceWorkspaceApiSchemaResource(client, id); } ); } @@ -726,20 +935,134 @@ public static ApiTagDescriptionResource GetApiTagDescriptionResource(this ArmCli } #endregion - #region ApiVersionSetResource + #region ServiceApiWikiResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceApiWikiResource GetServiceApiWikiResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceApiWikiResource.ValidateResourceId(id); + return new ServiceApiWikiResource(client, id); + } + ); + } + #endregion + + #region ServiceProductWikiResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceProductWikiResource GetServiceProductWikiResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceProductWikiResource.ValidateResourceId(id); + return new ServiceProductWikiResource(client, id); + } + ); + } + #endregion + + #region ServiceApiVersionSetResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceApiVersionSetResource GetServiceApiVersionSetResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceApiVersionSetResource.ValidateResourceId(id); + return new ServiceApiVersionSetResource(client, id); + } + ); + } + #endregion + + #region ServiceWorkspaceApiVersionSetResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceWorkspaceApiVersionSetResource GetServiceWorkspaceApiVersionSetResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceWorkspaceApiVersionSetResource.ValidateResourceId(id); + return new ServiceWorkspaceApiVersionSetResource(client, id); + } + ); + } + #endregion + + #region AuthorizationProviderContractResource /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static ApiVersionSetResource GetApiVersionSetResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static AuthorizationProviderContractResource GetAuthorizationProviderContractResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - ApiVersionSetResource.ValidateResourceId(id); - return new ApiVersionSetResource(client, id); + AuthorizationProviderContractResource.ValidateResourceId(id); + return new AuthorizationProviderContractResource(client, id); + } + ); + } + #endregion + + #region AuthorizationContractResource + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static AuthorizationContractResource GetAuthorizationContractResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + AuthorizationContractResource.ValidateResourceId(id); + return new AuthorizationContractResource(client, id); + } + ); + } + #endregion + + #region AuthorizationAccessPolicyContractResource + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static AuthorizationAccessPolicyContractResource GetAuthorizationAccessPolicyContractResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + AuthorizationAccessPolicyContractResource.ValidateResourceId(id); + return new AuthorizationAccessPolicyContractResource(client, id); } ); } @@ -859,6 +1182,25 @@ public static ApiManagementServiceResource GetApiManagementServiceResource(this } #endregion + #region DocumentationContractResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static DocumentationContractResource GetDocumentationContractResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DocumentationContractResource.ValidateResourceId(id); + return new DocumentationContractResource(client, id); + } + ); + } + #endregion + #region ApiManagementEmailTemplateResource /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. @@ -935,20 +1277,39 @@ public static ApiManagementGatewayCertificateAuthorityResource GetApiManagementG } #endregion - #region ApiManagementGroupResource + #region ServiceGroupResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceGroupResource GetServiceGroupResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceGroupResource.ValidateResourceId(id); + return new ServiceGroupResource(client, id); + } + ); + } + #endregion + + #region ServiceWorkspaceGroupResource /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static ApiManagementGroupResource GetApiManagementGroupResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServiceWorkspaceGroupResource GetServiceWorkspaceGroupResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - ApiManagementGroupResource.ValidateResourceId(id); - return new ApiManagementGroupResource(client, id); + ServiceWorkspaceGroupResource.ValidateResourceId(id); + return new ServiceWorkspaceGroupResource(client, id); } ); } @@ -992,39 +1353,77 @@ public static ApiManagementLoggerResource GetApiManagementLoggerResource(this Ar } #endregion - #region ApiManagementNamedValueResource + #region ServiceNamedValueResource /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static ApiManagementNamedValueResource GetApiManagementNamedValueResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServiceNamedValueResource GetServiceNamedValueResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - ApiManagementNamedValueResource.ValidateResourceId(id); - return new ApiManagementNamedValueResource(client, id); + ServiceNamedValueResource.ValidateResourceId(id); + return new ServiceNamedValueResource(client, id); } ); } #endregion - #region ApiManagementNotificationResource + #region ServiceWorkspaceNamedValueResource /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static ApiManagementNotificationResource GetApiManagementNotificationResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServiceWorkspaceNamedValueResource GetServiceWorkspaceNamedValueResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - ApiManagementNotificationResource.ValidateResourceId(id); - return new ApiManagementNotificationResource(client, id); + ServiceWorkspaceNamedValueResource.ValidateResourceId(id); + return new ServiceWorkspaceNamedValueResource(client, id); + } + ); + } + #endregion + + #region ServiceNotificationResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceNotificationResource GetServiceNotificationResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceNotificationResource.ValidateResourceId(id); + return new ServiceNotificationResource(client, id); + } + ); + } + #endregion + + #region ServiceWorkspaceNotificationResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceWorkspaceNotificationResource GetServiceWorkspaceNotificationResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceWorkspaceNotificationResource.ValidateResourceId(id); + return new ServiceWorkspaceNotificationResource(client, id); } ); } @@ -1049,6 +1448,63 @@ public static ApiManagementOpenIdConnectProviderResource GetApiManagementOpenIdC } #endregion + #region ServicePolicyFragmentResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServicePolicyFragmentResource GetServicePolicyFragmentResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServicePolicyFragmentResource.ValidateResourceId(id); + return new ServicePolicyFragmentResource(client, id); + } + ); + } + #endregion + + #region ServiceWorkspacePolicyFragmentResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceWorkspacePolicyFragmentResource GetServiceWorkspacePolicyFragmentResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceWorkspacePolicyFragmentResource.ValidateResourceId(id); + return new ServiceWorkspacePolicyFragmentResource(client, id); + } + ); + } + #endregion + + #region PortalConfigContractResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static PortalConfigContractResource GetPortalConfigContractResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + PortalConfigContractResource.ValidateResourceId(id); + return new PortalConfigContractResource(client, id); + } + ); + } + #endregion + #region ApiManagementPortalRevisionResource /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. @@ -1163,39 +1619,153 @@ public static ApiManagementPrivateLinkResource GetApiManagementPrivateLinkResour } #endregion - #region ApiManagementProductResource + #region ServiceProductResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceProductResource GetServiceProductResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceProductResource.ValidateResourceId(id); + return new ServiceProductResource(client, id); + } + ); + } + #endregion + + #region ServiceWorkspaceProductResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceWorkspaceProductResource GetServiceWorkspaceProductResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceWorkspaceProductResource.ValidateResourceId(id); + return new ServiceWorkspaceProductResource(client, id); + } + ); + } + #endregion + + #region ServiceProductApiLinkResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceProductApiLinkResource GetServiceProductApiLinkResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceProductApiLinkResource.ValidateResourceId(id); + return new ServiceProductApiLinkResource(client, id); + } + ); + } + #endregion + + #region ServiceWorkspaceProductApiLinkResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceWorkspaceProductApiLinkResource GetServiceWorkspaceProductApiLinkResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceWorkspaceProductApiLinkResource.ValidateResourceId(id); + return new ServiceWorkspaceProductApiLinkResource(client, id); + } + ); + } + #endregion + + #region ServiceProductGroupLinkResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceProductGroupLinkResource GetServiceProductGroupLinkResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceProductGroupLinkResource.ValidateResourceId(id); + return new ServiceProductGroupLinkResource(client, id); + } + ); + } + #endregion + + #region ServiceWorkspaceProductGroupLinkResource /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static ApiManagementProductResource GetApiManagementProductResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServiceWorkspaceProductGroupLinkResource GetServiceWorkspaceProductGroupLinkResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - ApiManagementProductResource.ValidateResourceId(id); - return new ApiManagementProductResource(client, id); + ServiceWorkspaceProductGroupLinkResource.ValidateResourceId(id); + return new ServiceWorkspaceProductGroupLinkResource(client, id); } ); } #endregion - #region ApiManagementGlobalSchemaResource + #region ServiceSchemaResource /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static ApiManagementGlobalSchemaResource GetApiManagementGlobalSchemaResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ServiceSchemaResource GetServiceSchemaResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - ApiManagementGlobalSchemaResource.ValidateResourceId(id); - return new ApiManagementGlobalSchemaResource(client, id); + ServiceSchemaResource.ValidateResourceId(id); + return new ServiceSchemaResource(client, id); + } + ); + } + #endregion + + #region ServiceWorkspaceSchemaResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceWorkspaceSchemaResource GetServiceWorkspaceSchemaResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceWorkspaceSchemaResource.ValidateResourceId(id); + return new ServiceWorkspaceSchemaResource(client, id); } ); } @@ -1258,6 +1828,139 @@ public static ApiManagementUserSubscriptionResource GetApiManagementUserSubscrip } #endregion + #region ServiceWorkspaceSubscriptionResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceWorkspaceSubscriptionResource GetServiceWorkspaceSubscriptionResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceWorkspaceSubscriptionResource.ValidateResourceId(id); + return new ServiceWorkspaceSubscriptionResource(client, id); + } + ); + } + #endregion + + #region ServiceTagApiLinkResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceTagApiLinkResource GetServiceTagApiLinkResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceTagApiLinkResource.ValidateResourceId(id); + return new ServiceTagApiLinkResource(client, id); + } + ); + } + #endregion + + #region ServiceWorkspaceTagApiLinkResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceWorkspaceTagApiLinkResource GetServiceWorkspaceTagApiLinkResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceWorkspaceTagApiLinkResource.ValidateResourceId(id); + return new ServiceWorkspaceTagApiLinkResource(client, id); + } + ); + } + #endregion + + #region ServiceTagOperationLinkResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceTagOperationLinkResource GetServiceTagOperationLinkResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceTagOperationLinkResource.ValidateResourceId(id); + return new ServiceTagOperationLinkResource(client, id); + } + ); + } + #endregion + + #region ServiceWorkspaceTagOperationLinkResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceWorkspaceTagOperationLinkResource GetServiceWorkspaceTagOperationLinkResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceWorkspaceTagOperationLinkResource.ValidateResourceId(id); + return new ServiceWorkspaceTagOperationLinkResource(client, id); + } + ); + } + #endregion + + #region ServiceTagProductLinkResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceTagProductLinkResource GetServiceTagProductLinkResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceTagProductLinkResource.ValidateResourceId(id); + return new ServiceTagProductLinkResource(client, id); + } + ); + } + #endregion + + #region ServiceWorkspaceTagProductLinkResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceWorkspaceTagProductLinkResource GetServiceWorkspaceTagProductLinkResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceWorkspaceTagProductLinkResource.ValidateResourceId(id); + return new ServiceWorkspaceTagProductLinkResource(client, id); + } + ); + } + #endregion + #region TenantAccessInfoResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. @@ -1295,5 +1998,24 @@ public static ApiManagementUserResource GetApiManagementUserResource(this ArmCli ); } #endregion + + #region WorkspaceContractResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static WorkspaceContractResource GetWorkspaceContractResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + WorkspaceContractResource.ValidateResourceId(id); + return new WorkspaceContractResource(client, id); + } + ); + } + #endregion } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceApiOperationSource.cs similarity index 60% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiOperationSource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceApiOperationSource.cs index bcb8db5c7bf5..1ee2baf8cd7e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiOperationSource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceApiOperationSource.cs @@ -14,27 +14,27 @@ namespace Azure.ResourceManager.ApiManagement { - internal class ApiOperationSource : IOperationSource + internal class ServiceApiOperationSource : IOperationSource { private readonly ArmClient _client; - internal ApiOperationSource(ArmClient client) + internal ServiceApiOperationSource(ArmClient client) { _client = client; } - ApiResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + ServiceApiResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = ApiData.DeserializeApiData(document.RootElement); - return new ApiResource(_client, data); + return new ServiceApiResource(_client, data); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); var data = ApiData.DeserializeApiData(document.RootElement); - return new ApiResource(_client, data); + return new ServiceApiResource(_client, data); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiSchemaOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceApiSchemaOperationSource.cs similarity index 58% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiSchemaOperationSource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceApiSchemaOperationSource.cs index bcc57a7e7b4c..8d1d9b1823e3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiSchemaOperationSource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceApiSchemaOperationSource.cs @@ -14,27 +14,27 @@ namespace Azure.ResourceManager.ApiManagement { - internal class ApiSchemaOperationSource : IOperationSource + internal class ServiceApiSchemaOperationSource : IOperationSource { private readonly ArmClient _client; - internal ApiSchemaOperationSource(ArmClient client) + internal ServiceApiSchemaOperationSource(ArmClient client) { _client = client; } - ApiSchemaResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + ServiceApiSchemaResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = ApiSchemaData.DeserializeApiSchemaData(document.RootElement); - return new ApiSchemaResource(_client, data); + return new ServiceApiSchemaResource(_client, data); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); var data = ApiSchemaData.DeserializeApiSchemaData(document.RootElement); - return new ApiSchemaResource(_client, data); + return new ServiceApiSchemaResource(_client, data); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiManagementNamedValueOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceNamedValueOperationSource.cs similarity index 57% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiManagementNamedValueOperationSource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceNamedValueOperationSource.cs index 030c49c75c74..5054207725d4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiManagementNamedValueOperationSource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceNamedValueOperationSource.cs @@ -14,27 +14,27 @@ namespace Azure.ResourceManager.ApiManagement { - internal class ApiManagementNamedValueOperationSource : IOperationSource + internal class ServiceNamedValueOperationSource : IOperationSource { private readonly ArmClient _client; - internal ApiManagementNamedValueOperationSource(ArmClient client) + internal ServiceNamedValueOperationSource(ArmClient client) { _client = client; } - ApiManagementNamedValueResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + ServiceNamedValueResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(document.RootElement); - return new ApiManagementNamedValueResource(_client, data); + return new ServiceNamedValueResource(_client, data); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); var data = ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(document.RootElement); - return new ApiManagementNamedValueResource(_client, data); + return new ServiceNamedValueResource(_client, data); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServicePolicyFragmentOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServicePolicyFragmentOperationSource.cs new file mode 100644 index 000000000000..19680fe884f7 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServicePolicyFragmentOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + internal class ServicePolicyFragmentOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ServicePolicyFragmentOperationSource(ArmClient client) + { + _client = client; + } + + ServicePolicyFragmentResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = PolicyFragmentContractData.DeserializePolicyFragmentContractData(document.RootElement); + return new ServicePolicyFragmentResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = PolicyFragmentContractData.DeserializePolicyFragmentContractData(document.RootElement); + return new ServicePolicyFragmentResource(_client, data); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiManagementGlobalSchemaOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceSchemaOperationSource.cs similarity index 57% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiManagementGlobalSchemaOperationSource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceSchemaOperationSource.cs index 68f112f35795..f9e3affef327 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ApiManagementGlobalSchemaOperationSource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceSchemaOperationSource.cs @@ -14,27 +14,27 @@ namespace Azure.ResourceManager.ApiManagement { - internal class ApiManagementGlobalSchemaOperationSource : IOperationSource + internal class ServiceSchemaOperationSource : IOperationSource { private readonly ArmClient _client; - internal ApiManagementGlobalSchemaOperationSource(ArmClient client) + internal ServiceSchemaOperationSource(ArmClient client) { _client = client; } - ApiManagementGlobalSchemaResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + ServiceSchemaResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(document.RootElement); - return new ApiManagementGlobalSchemaResource(_client, data); + return new ServiceSchemaResource(_client, data); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); var data = ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(document.RootElement); - return new ApiManagementGlobalSchemaResource(_client, data); + return new ServiceSchemaResource(_client, data); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceApiOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceApiOperationSource.cs new file mode 100644 index 000000000000..8318a3b28a63 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceApiOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + internal class ServiceWorkspaceApiOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ServiceWorkspaceApiOperationSource(ArmClient client) + { + _client = client; + } + + ServiceWorkspaceApiResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ApiData.DeserializeApiData(document.RootElement); + return new ServiceWorkspaceApiResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ApiData.DeserializeApiData(document.RootElement); + return new ServiceWorkspaceApiResource(_client, data); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceApiSchemaOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceApiSchemaOperationSource.cs new file mode 100644 index 000000000000..2af015cf0e2e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceApiSchemaOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + internal class ServiceWorkspaceApiSchemaOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ServiceWorkspaceApiSchemaOperationSource(ArmClient client) + { + _client = client; + } + + ServiceWorkspaceApiSchemaResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ApiSchemaData.DeserializeApiSchemaData(document.RootElement); + return new ServiceWorkspaceApiSchemaResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ApiSchemaData.DeserializeApiSchemaData(document.RootElement); + return new ServiceWorkspaceApiSchemaResource(_client, data); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceNamedValueOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceNamedValueOperationSource.cs new file mode 100644 index 000000000000..b6bee9c6eea5 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceNamedValueOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + internal class ServiceWorkspaceNamedValueOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ServiceWorkspaceNamedValueOperationSource(ArmClient client) + { + _client = client; + } + + ServiceWorkspaceNamedValueResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(document.RootElement); + return new ServiceWorkspaceNamedValueResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(document.RootElement); + return new ServiceWorkspaceNamedValueResource(_client, data); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspacePolicyFragmentOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspacePolicyFragmentOperationSource.cs new file mode 100644 index 000000000000..b19427886bcf --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspacePolicyFragmentOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + internal class ServiceWorkspacePolicyFragmentOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ServiceWorkspacePolicyFragmentOperationSource(ArmClient client) + { + _client = client; + } + + ServiceWorkspacePolicyFragmentResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = PolicyFragmentContractData.DeserializePolicyFragmentContractData(document.RootElement); + return new ServiceWorkspacePolicyFragmentResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = PolicyFragmentContractData.DeserializePolicyFragmentContractData(document.RootElement); + return new ServiceWorkspacePolicyFragmentResource(_client, data); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceSchemaOperationSource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceSchemaOperationSource.cs new file mode 100644 index 000000000000..3d0d2d9c4110 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/LongRunningOperation/ServiceWorkspaceSchemaOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + internal class ServiceWorkspaceSchemaOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ServiceWorkspaceSchemaOperationSource(ArmClient client) + { + _client = client; + } + + ServiceWorkspaceSchemaResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(document.RootElement); + return new ServiceWorkspaceSchemaResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(document.RootElement); + return new ServiceWorkspaceSchemaResource(_client, data); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.Serialization.cs index 942f3c53ff04..9a36605f4b92 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.Serialization.cs @@ -42,6 +42,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("virtualNetworkConfiguration"u8); writer.WriteObjectValue(VirtualNetworkConfiguration); } + if (Optional.IsDefined(NatGatewayState)) + { + writer.WritePropertyName("natGatewayState"u8); + writer.WriteStringValue(NatGatewayState.Value.ToString()); + } if (Optional.IsDefined(DisableGateway)) { writer.WritePropertyName("disableGateway"u8); @@ -64,6 +69,8 @@ internal static AdditionalLocation DeserializeAdditionalLocation(JsonElement ele Optional publicIPAddressId = default; Optional virtualNetworkConfiguration = default; Optional gatewayRegionalUri = default; + Optional natGatewayState = default; + Optional> outboundPublicIPAddresses = default; Optional disableGateway = default; Optional platformVersion = default; foreach (var property in element.EnumerateObject()) @@ -167,6 +174,31 @@ internal static AdditionalLocation DeserializeAdditionalLocation(JsonElement ele gatewayRegionalUri = new Uri(property.Value.GetString()); continue; } + if (property.NameEquals("natGatewayState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + natGatewayState = new NatGatewayState(property.Value.GetString()); + continue; + } + if (property.NameEquals("outboundPublicIPAddresses"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + outboundPublicIPAddresses = array; + continue; + } if (property.NameEquals("disableGateway"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -188,7 +220,7 @@ internal static AdditionalLocation DeserializeAdditionalLocation(JsonElement ele continue; } } - return new AdditionalLocation(location, sku, Optional.ToList(zones), Optional.ToList(publicIPAddresses), Optional.ToList(privateIPAddresses), publicIPAddressId.Value, virtualNetworkConfiguration.Value, gatewayRegionalUri.Value, Optional.ToNullable(disableGateway), Optional.ToNullable(platformVersion)); + return new AdditionalLocation(location, sku, Optional.ToList(zones), Optional.ToList(publicIPAddresses), Optional.ToList(privateIPAddresses), publicIPAddressId.Value, virtualNetworkConfiguration.Value, gatewayRegionalUri.Value, Optional.ToNullable(natGatewayState), Optional.ToList(outboundPublicIPAddresses), Optional.ToNullable(disableGateway), Optional.ToNullable(platformVersion)); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.cs index 377f7a3cf48f..48301425dc75 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AdditionalLocation.cs @@ -28,6 +28,7 @@ public AdditionalLocation(AzureLocation location, ApiManagementServiceSkuPropert Zones = new ChangeTrackingList(); PublicIPAddresses = new ChangeTrackingList(); PrivateIPAddresses = new ChangeTrackingList(); + OutboundPublicIPAddresses = new ChangeTrackingList(); } /// Initializes a new instance of AdditionalLocation. @@ -39,9 +40,11 @@ public AdditionalLocation(AzureLocation location, ApiManagementServiceSkuPropert /// 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. /// Virtual network configuration for the location. /// Gateway URL of the API Management service in the Region. + /// Property can be used to enable NAT Gateway for this API Management service. + /// Outbound public IPV4 address prefixes associated with NAT Gateway deployed service. Available only for Premium SKU on stv2 platform. /// Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in this additional location. /// Compute Platform Version running the service. - internal AdditionalLocation(AzureLocation location, ApiManagementServiceSkuProperties sku, IList zones, IReadOnlyList publicIPAddresses, IReadOnlyList privateIPAddresses, ResourceIdentifier publicIPAddressId, VirtualNetworkConfiguration virtualNetworkConfiguration, Uri gatewayRegionalUri, bool? disableGateway, PlatformVersion? platformVersion) + internal AdditionalLocation(AzureLocation location, ApiManagementServiceSkuProperties sku, IList zones, IReadOnlyList publicIPAddresses, IReadOnlyList privateIPAddresses, ResourceIdentifier publicIPAddressId, VirtualNetworkConfiguration virtualNetworkConfiguration, Uri gatewayRegionalUri, NatGatewayState? natGatewayState, IReadOnlyList outboundPublicIPAddresses, bool? disableGateway, PlatformVersion? platformVersion) { Location = location; Sku = sku; @@ -51,6 +54,8 @@ internal AdditionalLocation(AzureLocation location, ApiManagementServiceSkuPrope PublicIPAddressId = publicIPAddressId; VirtualNetworkConfiguration = virtualNetworkConfiguration; GatewayRegionalUri = gatewayRegionalUri; + NatGatewayState = natGatewayState; + OutboundPublicIPAddresses = outboundPublicIPAddresses; DisableGateway = disableGateway; PlatformVersion = platformVersion; } @@ -71,6 +76,10 @@ internal AdditionalLocation(AzureLocation location, ApiManagementServiceSkuPrope public VirtualNetworkConfiguration VirtualNetworkConfiguration { get; set; } /// Gateway URL of the API Management service in the Region. public Uri GatewayRegionalUri { get; } + /// Property can be used to enable NAT Gateway for this API Management service. + public NatGatewayState? NatGatewayState { get; set; } + /// Outbound public IPV4 address prefixes associated with NAT Gateway deployed service. Available only for Premium SKU on stv2 platform. + public IReadOnlyList OutboundPublicIPAddresses { get; } /// Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in this additional location. public bool? DisableGateway { get; set; } /// Compute Platform Version running the service. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateParameter.Serialization.cs similarity index 93% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateParameter.Serialization.cs index 9bf70c043dd9..ae27ebfa1df6 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateParameter.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiCreateOrUpdateContent : IUtf8JsonSerializable + public partial class ApiCreateOrUpdateParameter : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -142,6 +142,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("apiType"u8); writer.WriteStringValue(SoapApiType.Value.ToString()); } + if (Optional.IsDefined(TranslateRequiredQueryParametersConduct)) + { + writer.WritePropertyName("translateRequiredQueryParameters"u8); + writer.WriteStringValue(TranslateRequiredQueryParametersConduct.Value.ToString()); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateParameter.cs similarity index 91% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateParameter.cs index 20deabffcd14..fc2ed4387cc7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiCreateOrUpdateParameter.cs @@ -12,10 +12,10 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// API Create or Update Parameters. - public partial class ApiCreateOrUpdateContent + public partial class ApiCreateOrUpdateParameter { - /// Initializes a new instance of ApiCreateOrUpdateContent. - public ApiCreateOrUpdateContent() + /// Initializes a new instance of ApiCreateOrUpdateParameter. + public ApiCreateOrUpdateParameter() { Protocols = new ChangeTrackingList(); } @@ -76,5 +76,7 @@ public ApiCreateOrUpdateContent() /// * `graphql` creates GraphQL API. /// public SoapApiType? SoapApiType { get; set; } + /// Strategy of translating required query parameters to template ones. By default has value 'template'. Possible values: 'template', 'query'. + public TranslateRequiredQueryParametersConduct? TranslateRequiredQueryParametersConduct { get; set; } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerData.Serialization.cs index e22914f8b00c..1ce9c84108c9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerData.Serialization.cs @@ -95,6 +95,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("displayName"u8); writer.WriteStringValue(DisplayName); } + if (Optional.IsDefined(UseInTestConsole)) + { + writer.WritePropertyName("useInTestConsole"u8); + writer.WriteBooleanValue(UseInTestConsole.Value); + } + if (Optional.IsDefined(UseInApiDocumentation)) + { + writer.WritePropertyName("useInApiDocumentation"u8); + writer.WriteBooleanValue(UseInApiDocumentation.Value); + } if (Optional.IsDefined(ClientRegistrationEndpoint)) { writer.WritePropertyName("clientRegistrationEndpoint"u8); @@ -150,6 +160,8 @@ internal static ApiManagementAuthorizationServerData DeserializeApiManagementAut Optional resourceOwnerUsername = default; Optional resourceOwnerPassword = default; Optional displayName = default; + Optional useInTestConsole = default; + Optional useInApiDocumentation = default; Optional clientRegistrationEndpoint = default; Optional authorizationEndpoint = default; Optional> grantTypes = default; @@ -291,6 +303,26 @@ internal static ApiManagementAuthorizationServerData DeserializeApiManagementAut displayName = property0.Value.GetString(); continue; } + if (property0.NameEquals("useInTestConsole"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + useInTestConsole = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("useInApiDocumentation"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + useInApiDocumentation = property0.Value.GetBoolean(); + continue; + } if (property0.NameEquals("clientRegistrationEndpoint"u8)) { clientRegistrationEndpoint = property0.Value.GetString(); @@ -330,7 +362,7 @@ internal static ApiManagementAuthorizationServerData DeserializeApiManagementAut continue; } } - return new ApiManagementAuthorizationServerData(id, name, type, systemData.Value, description.Value, Optional.ToList(authorizationMethods), Optional.ToList(clientAuthenticationMethod), Optional.ToList(tokenBodyParameters), tokenEndpoint.Value, Optional.ToNullable(supportState), defaultScope.Value, Optional.ToList(bearerTokenSendingMethods), resourceOwnerUsername.Value, resourceOwnerPassword.Value, displayName.Value, clientRegistrationEndpoint.Value, authorizationEndpoint.Value, Optional.ToList(grantTypes), clientId.Value, clientSecret.Value); + return new ApiManagementAuthorizationServerData(id, name, type, systemData.Value, description.Value, Optional.ToList(authorizationMethods), Optional.ToList(clientAuthenticationMethod), Optional.ToList(tokenBodyParameters), tokenEndpoint.Value, Optional.ToNullable(supportState), defaultScope.Value, Optional.ToList(bearerTokenSendingMethods), resourceOwnerUsername.Value, resourceOwnerPassword.Value, displayName.Value, Optional.ToNullable(useInTestConsole), Optional.ToNullable(useInApiDocumentation), clientRegistrationEndpoint.Value, authorizationEndpoint.Value, Optional.ToList(grantTypes), clientId.Value, clientSecret.Value); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.Serialization.cs index ebdbd3337c08..0a82aa904556 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.Serialization.cs @@ -94,6 +94,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("displayName"u8); writer.WriteStringValue(DisplayName); } + if (Optional.IsDefined(UseInTestConsole)) + { + writer.WritePropertyName("useInTestConsole"u8); + writer.WriteBooleanValue(UseInTestConsole.Value); + } + if (Optional.IsDefined(UseInApiDocumentation)) + { + writer.WritePropertyName("useInApiDocumentation"u8); + writer.WriteBooleanValue(UseInApiDocumentation.Value); + } if (Optional.IsDefined(ClientRegistrationEndpoint)) { writer.WritePropertyName("clientRegistrationEndpoint"u8); @@ -149,6 +159,8 @@ internal static ApiManagementAuthorizationServerPatch DeserializeApiManagementAu Optional resourceOwnerUsername = default; Optional resourceOwnerPassword = default; Optional displayName = default; + Optional useInTestConsole = default; + Optional useInApiDocumentation = default; Optional clientRegistrationEndpoint = default; Optional authorizationEndpoint = default; Optional> grantTypes = default; @@ -290,6 +302,26 @@ internal static ApiManagementAuthorizationServerPatch DeserializeApiManagementAu displayName = property0.Value.GetString(); continue; } + if (property0.NameEquals("useInTestConsole"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + useInTestConsole = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("useInApiDocumentation"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + useInApiDocumentation = property0.Value.GetBoolean(); + continue; + } if (property0.NameEquals("clientRegistrationEndpoint"u8)) { clientRegistrationEndpoint = property0.Value.GetString(); @@ -329,7 +361,7 @@ internal static ApiManagementAuthorizationServerPatch DeserializeApiManagementAu continue; } } - return new ApiManagementAuthorizationServerPatch(id, name, type, systemData.Value, description.Value, Optional.ToList(authorizationMethods), Optional.ToList(clientAuthenticationMethod), Optional.ToList(tokenBodyParameters), tokenEndpoint.Value, Optional.ToNullable(supportState), defaultScope.Value, Optional.ToList(bearerTokenSendingMethods), resourceOwnerUsername.Value, resourceOwnerPassword.Value, displayName.Value, clientRegistrationEndpoint.Value, authorizationEndpoint.Value, Optional.ToList(grantTypes), clientId.Value, clientSecret.Value); + return new ApiManagementAuthorizationServerPatch(id, name, type, systemData.Value, description.Value, Optional.ToList(authorizationMethods), Optional.ToList(clientAuthenticationMethod), Optional.ToList(tokenBodyParameters), tokenEndpoint.Value, Optional.ToNullable(supportState), defaultScope.Value, Optional.ToList(bearerTokenSendingMethods), resourceOwnerUsername.Value, resourceOwnerPassword.Value, displayName.Value, Optional.ToNullable(useInTestConsole), Optional.ToNullable(useInApiDocumentation), clientRegistrationEndpoint.Value, authorizationEndpoint.Value, Optional.ToList(grantTypes), clientId.Value, clientSecret.Value); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.cs index 5c54650d4e25..ab6c7cebec67 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementAuthorizationServerPatch.cs @@ -40,12 +40,14 @@ public ApiManagementAuthorizationServerPatch() /// Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. /// Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. /// User-friendly authorization server name. + /// If true, the authorization server may be used in the developer portal test console. True by default if no value is provided. + /// If true, the authorization server will be used in the API documentation in the developer portal. False by default if no value is provided. /// Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. /// OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. /// Form of an authorization grant, which the client uses to request the access token. /// Client or app id registered with this authorization server. /// Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - internal ApiManagementAuthorizationServerPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, IList authorizationMethods, IList clientAuthenticationMethods, IList tokenBodyParameters, string tokenEndpoint, bool? doesSupportState, string defaultScope, IList bearerTokenSendingMethods, string resourceOwnerUsername, string resourceOwnerPassword, string displayName, string clientRegistrationEndpoint, string authorizationEndpoint, IList grantTypes, string clientId, string clientSecret) : base(id, name, resourceType, systemData) + internal ApiManagementAuthorizationServerPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string description, IList authorizationMethods, IList clientAuthenticationMethods, IList tokenBodyParameters, string tokenEndpoint, bool? doesSupportState, string defaultScope, IList bearerTokenSendingMethods, string resourceOwnerUsername, string resourceOwnerPassword, string displayName, bool? useInTestConsole, bool? useInApiDocumentation, string clientRegistrationEndpoint, string authorizationEndpoint, IList grantTypes, string clientId, string clientSecret) : base(id, name, resourceType, systemData) { Description = description; AuthorizationMethods = authorizationMethods; @@ -58,6 +60,8 @@ internal ApiManagementAuthorizationServerPatch(ResourceIdentifier id, string nam ResourceOwnerUsername = resourceOwnerUsername; ResourceOwnerPassword = resourceOwnerPassword; DisplayName = displayName; + UseInTestConsole = useInTestConsole; + UseInApiDocumentation = useInApiDocumentation; ClientRegistrationEndpoint = clientRegistrationEndpoint; AuthorizationEndpoint = authorizationEndpoint; GrantTypes = grantTypes; @@ -87,6 +91,10 @@ internal ApiManagementAuthorizationServerPatch(ResourceIdentifier id, string nam public string ResourceOwnerPassword { get; set; } /// User-friendly authorization server name. public string DisplayName { get; set; } + /// If true, the authorization server may be used in the developer portal test console. True by default if no value is provided. + public bool? UseInTestConsole { get; set; } + /// If true, the authorization server will be used in the API documentation in the developer portal. False by default if no value is provided. + public bool? UseInApiDocumentation { get; set; } /// Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. public string ClientRegistrationEndpoint { get; set; } /// OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendData.Serialization.cs index 6da7a844457f..650754bbb57f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendData.Serialization.cs @@ -55,6 +55,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("tls"u8); writer.WriteObjectValue(Tls); } + if (Optional.IsDefined(CircuitBreaker)) + { + writer.WritePropertyName("circuitBreaker"u8); + writer.WriteObjectValue(CircuitBreaker); + } if (Optional.IsDefined(Uri)) { writer.WritePropertyName("url"u8); @@ -86,6 +91,7 @@ internal static ApiManagementBackendData DeserializeApiManagementBackendData(Jso Optional credentials = default; Optional proxy = default; Optional tls = default; + Optional circuitBreaker = default; Optional uri = default; Optional protocol = default; foreach (var property in element.EnumerateObject()) @@ -184,6 +190,16 @@ internal static ApiManagementBackendData DeserializeApiManagementBackendData(Jso tls = BackendTlsProperties.DeserializeBackendTlsProperties(property0.Value); continue; } + if (property0.NameEquals("circuitBreaker"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + circuitBreaker = BackendCircuitBreaker.DeserializeBackendCircuitBreaker(property0.Value); + continue; + } if (property0.NameEquals("url"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -208,7 +224,7 @@ internal static ApiManagementBackendData DeserializeApiManagementBackendData(Jso continue; } } - return new ApiManagementBackendData(id, name, type, systemData.Value, title.Value, description.Value, resourceId.Value, properties.Value, credentials.Value, proxy.Value, tls.Value, uri.Value, Optional.ToNullable(protocol)); + return new ApiManagementBackendData(id, name, type, systemData.Value, title.Value, description.Value, resourceId.Value, properties.Value, credentials.Value, proxy.Value, tls.Value, circuitBreaker.Value, uri.Value, Optional.ToNullable(protocol)); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.Serialization.cs index 02cf45f10df6..0e2ea11d5d2f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.Serialization.cs @@ -52,6 +52,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("tls"u8); writer.WriteObjectValue(Tls); } + if (Optional.IsDefined(CircuitBreaker)) + { + writer.WritePropertyName("circuitBreaker"u8); + writer.WriteObjectValue(CircuitBreaker); + } if (Optional.IsDefined(Uri)) { writer.WritePropertyName("url"u8); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.cs index 2ba20ee50e13..4c80dc6eaa78 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementBackendPatch.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; namespace Azure.ResourceManager.ApiManagement.Models { @@ -21,7 +22,7 @@ public ApiManagementBackendPatch() public string Title { get; set; } /// Backend Description. public string Description { get; set; } - /// Management Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. + /// Management Uri of the Resource in External System. This URL can be the Arm Resource Id of Logic Apps, Function Apps or API Apps. public Uri ResourceUri { get; set; } /// Backend Properties contract. internal BackendProperties Properties { get; set; } @@ -39,10 +40,23 @@ public BackendServiceFabricClusterProperties BackendServiceFabricCluster /// Backend Credentials Contract Properties. public BackendCredentialsContract Credentials { get; set; } - /// Backend Proxy Contract Properties. + /// Backend gateway Contract Properties. public BackendProxyContract Proxy { get; set; } /// Backend TLS Properties. public BackendTlsProperties Tls { get; set; } + /// Backend Circuit Breaker Configuration. + internal BackendCircuitBreaker CircuitBreaker { get; set; } + /// The rules for tripping the backend. + public IList CircuitBreakerRules + { + get + { + if (CircuitBreaker is null) + CircuitBreaker = new BackendCircuitBreaker(); + return CircuitBreaker.Rules; + } + } + /// Runtime Url of the Backend. public Uri Uri { get; set; } /// Backend communication protocol. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.Serialization.cs index 88c36fa76dde..0535c0299b65 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.Serialization.cs @@ -64,6 +64,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("passwordResetPolicyName"u8); writer.WriteStringValue(PasswordResetPolicyName); } + if (Optional.IsDefined(ClientLibrary)) + { + writer.WritePropertyName("clientLibrary"u8); + writer.WriteStringValue(ClientLibrary); + } if (Optional.IsDefined(ClientId)) { writer.WritePropertyName("clientId"u8); @@ -96,6 +101,7 @@ internal static ApiManagementIdentityProviderCreateOrUpdateContent DeserializeAp Optional signinPolicyName = default; Optional profileEditingPolicyName = default; Optional passwordResetPolicyName = default; + Optional clientLibrary = default; Optional clientId = default; Optional clientSecret = default; foreach (var property in element.EnumerateObject()) @@ -189,6 +195,11 @@ internal static ApiManagementIdentityProviderCreateOrUpdateContent DeserializeAp passwordResetPolicyName = property0.Value.GetString(); continue; } + if (property0.NameEquals("clientLibrary"u8)) + { + clientLibrary = property0.Value.GetString(); + continue; + } if (property0.NameEquals("clientId"u8)) { clientId = property0.Value.GetString(); @@ -203,7 +214,7 @@ internal static ApiManagementIdentityProviderCreateOrUpdateContent DeserializeAp continue; } } - return new ApiManagementIdentityProviderCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToNullable(type0), signinTenant.Value, Optional.ToList(allowedTenants), authority.Value, signupPolicyName.Value, signinPolicyName.Value, profileEditingPolicyName.Value, passwordResetPolicyName.Value, clientId.Value, clientSecret.Value); + return new ApiManagementIdentityProviderCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToNullable(type0), signinTenant.Value, Optional.ToList(allowedTenants), authority.Value, signupPolicyName.Value, signinPolicyName.Value, profileEditingPolicyName.Value, passwordResetPolicyName.Value, clientLibrary.Value, clientId.Value, clientSecret.Value); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.cs index aec3057b71a1..a22cdf146b6b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderCreateOrUpdateContent.cs @@ -33,9 +33,10 @@ public ApiManagementIdentityProviderCreateOrUpdateContent() /// Signin Policy Name. Only applies to AAD B2C Identity Provider. /// Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. /// Password Reset Policy Name. Only applies to AAD B2C Identity Provider. + /// The client library to be used in the developer portal. Only applies to AAD and AAD B2C Identity Provider. /// Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. /// 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. - internal ApiManagementIdentityProviderCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IdentityProviderType? identityProviderType, string signInTenant, IList allowedTenants, string authority, string signUpPolicyName, string signInPolicyName, string profileEditingPolicyName, string passwordResetPolicyName, string clientId, string clientSecret) : base(id, name, resourceType, systemData) + internal ApiManagementIdentityProviderCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IdentityProviderType? identityProviderType, string signInTenant, IList allowedTenants, string authority, string signUpPolicyName, string signInPolicyName, string profileEditingPolicyName, string passwordResetPolicyName, string clientLibrary, string clientId, string clientSecret) : base(id, name, resourceType, systemData) { IdentityProviderType = identityProviderType; SignInTenant = signInTenant; @@ -45,6 +46,7 @@ internal ApiManagementIdentityProviderCreateOrUpdateContent(ResourceIdentifier i SignInPolicyName = signInPolicyName; ProfileEditingPolicyName = profileEditingPolicyName; PasswordResetPolicyName = passwordResetPolicyName; + ClientLibrary = clientLibrary; ClientId = clientId; ClientSecret = clientSecret; } @@ -65,6 +67,8 @@ internal ApiManagementIdentityProviderCreateOrUpdateContent(ResourceIdentifier i public string ProfileEditingPolicyName { get; set; } /// Password Reset Policy Name. Only applies to AAD B2C Identity Provider. public string PasswordResetPolicyName { get; set; } + /// The client library to be used in the developer portal. Only applies to AAD and AAD B2C Identity Provider. + public string ClientLibrary { get; set; } /// Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. public string ClientId { get; set; } /// 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. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderData.Serialization.cs index bb6547cf37ef..9cc2cbf32823 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderData.Serialization.cs @@ -65,6 +65,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("passwordResetPolicyName"u8); writer.WriteStringValue(PasswordResetPolicyName); } + if (Optional.IsDefined(ClientLibrary)) + { + writer.WritePropertyName("clientLibrary"u8); + writer.WriteStringValue(ClientLibrary); + } if (Optional.IsDefined(ClientId)) { writer.WritePropertyName("clientId"u8); @@ -97,6 +102,7 @@ internal static ApiManagementIdentityProviderData DeserializeApiManagementIdenti Optional signinPolicyName = default; Optional profileEditingPolicyName = default; Optional passwordResetPolicyName = default; + Optional clientLibrary = default; Optional clientId = default; Optional clientSecret = default; foreach (var property in element.EnumerateObject()) @@ -190,6 +196,11 @@ internal static ApiManagementIdentityProviderData DeserializeApiManagementIdenti passwordResetPolicyName = property0.Value.GetString(); continue; } + if (property0.NameEquals("clientLibrary"u8)) + { + clientLibrary = property0.Value.GetString(); + continue; + } if (property0.NameEquals("clientId"u8)) { clientId = property0.Value.GetString(); @@ -204,7 +215,7 @@ internal static ApiManagementIdentityProviderData DeserializeApiManagementIdenti continue; } } - return new ApiManagementIdentityProviderData(id, name, type, systemData.Value, Optional.ToNullable(type0), signinTenant.Value, Optional.ToList(allowedTenants), authority.Value, signupPolicyName.Value, signinPolicyName.Value, profileEditingPolicyName.Value, passwordResetPolicyName.Value, clientId.Value, clientSecret.Value); + return new ApiManagementIdentityProviderData(id, name, type, systemData.Value, Optional.ToNullable(type0), signinTenant.Value, Optional.ToList(allowedTenants), authority.Value, signupPolicyName.Value, signinPolicyName.Value, profileEditingPolicyName.Value, passwordResetPolicyName.Value, clientLibrary.Value, clientId.Value, clientSecret.Value); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.Serialization.cs index 0fd832756a99..eab20f3412cb 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.Serialization.cs @@ -62,6 +62,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("passwordResetPolicyName"u8); writer.WriteStringValue(PasswordResetPolicyName); } + if (Optional.IsDefined(ClientLibrary)) + { + writer.WritePropertyName("clientLibrary"u8); + writer.WriteStringValue(ClientLibrary); + } if (Optional.IsDefined(ClientId)) { writer.WritePropertyName("clientId"u8); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.cs index 74d338d8322e..ece4dad6feca 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementIdentityProviderPatch.cs @@ -35,6 +35,8 @@ public ApiManagementIdentityProviderPatch() public string ProfileEditingPolicyName { get; set; } /// Password Reset Policy Name. Only applies to AAD B2C Identity Provider. public string PasswordResetPolicyName { get; set; } + /// The client library to be used in the developer portal. Only applies to AAD and AAD B2C Identity Provider. + public string ClientLibrary { get; set; } /// Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. public string ClientId { get; set; } /// 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. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderData.Serialization.cs index 77445406788c..a48bdb5c1d56 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderData.Serialization.cs @@ -43,6 +43,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("clientSecret"u8); writer.WriteStringValue(ClientSecret); } + if (Optional.IsDefined(UseInTestConsole)) + { + writer.WritePropertyName("useInTestConsole"u8); + writer.WriteBooleanValue(UseInTestConsole.Value); + } + if (Optional.IsDefined(UseInApiDocumentation)) + { + writer.WritePropertyName("useInApiDocumentation"u8); + writer.WriteBooleanValue(UseInApiDocumentation.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -62,6 +72,8 @@ internal static ApiManagementOpenIdConnectProviderData DeserializeApiManagementO Optional metadataEndpoint = default; Optional clientId = default; Optional clientSecret = default; + Optional useInTestConsole = default; + Optional useInApiDocumentation = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -123,11 +135,31 @@ internal static ApiManagementOpenIdConnectProviderData DeserializeApiManagementO clientSecret = property0.Value.GetString(); continue; } + if (property0.NameEquals("useInTestConsole"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + useInTestConsole = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("useInApiDocumentation"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + useInApiDocumentation = property0.Value.GetBoolean(); + continue; + } } continue; } } - return new ApiManagementOpenIdConnectProviderData(id, name, type, systemData.Value, displayName.Value, description.Value, metadataEndpoint.Value, clientId.Value, clientSecret.Value); + return new ApiManagementOpenIdConnectProviderData(id, name, type, systemData.Value, displayName.Value, description.Value, metadataEndpoint.Value, clientId.Value, clientSecret.Value, Optional.ToNullable(useInTestConsole), Optional.ToNullable(useInApiDocumentation)); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.Serialization.cs index e8f0b52e9273..c0a2fc201b65 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.Serialization.cs @@ -42,6 +42,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("clientSecret"u8); writer.WriteStringValue(ClientSecret); } + if (Optional.IsDefined(UseInTestConsole)) + { + writer.WritePropertyName("useInTestConsole"u8); + writer.WriteBooleanValue(UseInTestConsole.Value); + } + if (Optional.IsDefined(UseInApiDocumentation)) + { + writer.WritePropertyName("useInApiDocumentation"u8); + writer.WriteBooleanValue(UseInApiDocumentation.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.cs index 789866c59544..858c4eccc691 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementOpenIdConnectProviderPatch.cs @@ -25,5 +25,9 @@ public ApiManagementOpenIdConnectProviderPatch() public string ClientId { get; set; } /// Client Secret of developer console which is the client application. public string ClientSecret { get; set; } + /// If true, the Open ID Connect provider may be used in the developer portal test console. True by default if no value is provided. + public bool? UseInTestConsole { get; set; } + /// 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. + public bool? UseInApiDocumentation { get; set; } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceData.Serialization.cs index 318aca32b93d..61663cf1bf98 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceData.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServiceData.Serialization.cs @@ -119,6 +119,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("enableClientCertificate"u8); writer.WriteBooleanValue(EnableClientCertificate.Value); } + if (Optional.IsDefined(NatGatewayState)) + { + writer.WritePropertyName("natGatewayState"u8); + writer.WriteStringValue(NatGatewayState.Value.ToString()); + } if (Optional.IsDefined(DisableGateway)) { writer.WritePropertyName("disableGateway"u8); @@ -193,6 +198,8 @@ internal static ApiManagementServiceData DeserializeApiManagementServiceData(Jso Optional> customProperties = default; Optional> certificates = default; Optional enableClientCertificate = default; + Optional natGatewayState = default; + Optional> outboundPublicIPAddresses = default; Optional disableGateway = default; Optional virtualNetworkType = default; Optional apiVersionConstraint = default; @@ -526,6 +533,31 @@ internal static ApiManagementServiceData DeserializeApiManagementServiceData(Jso enableClientCertificate = property0.Value.GetBoolean(); continue; } + if (property0.NameEquals("natGatewayState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + natGatewayState = new NatGatewayState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("outboundPublicIPAddresses"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + outboundPublicIPAddresses = array; + continue; + } if (property0.NameEquals("disableGateway"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -605,7 +637,7 @@ internal static ApiManagementServiceData DeserializeApiManagementServiceData(Jso continue; } } - return new ApiManagementServiceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku, identity, Optional.ToNullable(etag), Optional.ToList(zones), notificationSenderEmail.Value, provisioningState.Value, targetProvisioningState.Value, Optional.ToNullable(createdAtUtc), gatewayUri.Value, gatewayRegionalUri.Value, portalUri.Value, managementApiUri.Value, scmUri.Value, developerPortalUri.Value, Optional.ToList(hostnameConfigurations), Optional.ToList(publicIPAddresses), Optional.ToList(privateIPAddresses), publicIPAddressId.Value, Optional.ToNullable(publicNetworkAccess), virtualNetworkConfiguration.Value, Optional.ToList(additionalLocations), Optional.ToDictionary(customProperties), Optional.ToList(certificates), Optional.ToNullable(enableClientCertificate), Optional.ToNullable(disableGateway), Optional.ToNullable(virtualNetworkType), apiVersionConstraint.Value, Optional.ToNullable(restore), Optional.ToList(privateEndpointConnections), Optional.ToNullable(platformVersion), publisherEmail, publisherName); + return new ApiManagementServiceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku, identity, Optional.ToNullable(etag), Optional.ToList(zones), notificationSenderEmail.Value, provisioningState.Value, targetProvisioningState.Value, Optional.ToNullable(createdAtUtc), gatewayUri.Value, gatewayRegionalUri.Value, portalUri.Value, managementApiUri.Value, scmUri.Value, developerPortalUri.Value, Optional.ToList(hostnameConfigurations), Optional.ToList(publicIPAddresses), Optional.ToList(privateIPAddresses), publicIPAddressId.Value, Optional.ToNullable(publicNetworkAccess), virtualNetworkConfiguration.Value, Optional.ToList(additionalLocations), Optional.ToDictionary(customProperties), Optional.ToList(certificates), Optional.ToNullable(enableClientCertificate), Optional.ToNullable(natGatewayState), Optional.ToList(outboundPublicIPAddresses), Optional.ToNullable(disableGateway), Optional.ToNullable(virtualNetworkType), apiVersionConstraint.Value, Optional.ToNullable(restore), Optional.ToList(privateEndpointConnections), Optional.ToNullable(platformVersion), publisherEmail, publisherName); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.Serialization.cs index f33c1e31e69c..a36c63bf8a05 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.Serialization.cs @@ -119,6 +119,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("enableClientCertificate"u8); writer.WriteBooleanValue(EnableClientCertificate.Value); } + if (Optional.IsDefined(NatGatewayState)) + { + writer.WritePropertyName("natGatewayState"u8); + writer.WriteStringValue(NatGatewayState.Value.ToString()); + } if (Optional.IsDefined(DisableGateway)) { writer.WritePropertyName("disableGateway"u8); @@ -198,6 +203,8 @@ internal static ApiManagementServicePatch DeserializeApiManagementServicePatch(J Optional> customProperties = default; Optional> certificates = default; Optional enableClientCertificate = default; + Optional natGatewayState = default; + Optional> outboundPublicIPAddresses = default; Optional disableGateway = default; Optional virtualNetworkType = default; Optional apiVersionConstraint = default; @@ -531,6 +538,31 @@ internal static ApiManagementServicePatch DeserializeApiManagementServicePatch(J enableClientCertificate = property0.Value.GetBoolean(); continue; } + if (property0.NameEquals("natGatewayState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + natGatewayState = new NatGatewayState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("outboundPublicIPAddresses"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + outboundPublicIPAddresses = array; + continue; + } if (property0.NameEquals("disableGateway"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -610,7 +642,7 @@ internal static ApiManagementServicePatch DeserializeApiManagementServicePatch(J continue; } } - return new ApiManagementServicePatch(id, name, type, systemData.Value, sku.Value, identity, Optional.ToNullable(etag), Optional.ToList(zones), notificationSenderEmail.Value, provisioningState.Value, targetProvisioningState.Value, Optional.ToNullable(createdAtUtc), gatewayUri.Value, gatewayRegionalUri.Value, portalUri.Value, managementApiUri.Value, scmUri.Value, developerPortalUri.Value, Optional.ToList(hostnameConfigurations), Optional.ToList(publicIPAddresses), Optional.ToList(privateIPAddresses), publicIPAddressId.Value, Optional.ToNullable(publicNetworkAccess), virtualNetworkConfiguration.Value, Optional.ToList(additionalLocations), Optional.ToDictionary(customProperties), Optional.ToList(certificates), Optional.ToNullable(enableClientCertificate), Optional.ToNullable(disableGateway), Optional.ToNullable(virtualNetworkType), apiVersionConstraint.Value, Optional.ToNullable(restore), Optional.ToList(privateEndpointConnections), Optional.ToNullable(platformVersion), publisherEmail.Value, publisherName.Value, Optional.ToDictionary(tags)); + return new ApiManagementServicePatch(id, name, type, systemData.Value, sku.Value, identity, Optional.ToNullable(etag), Optional.ToList(zones), notificationSenderEmail.Value, provisioningState.Value, targetProvisioningState.Value, Optional.ToNullable(createdAtUtc), gatewayUri.Value, gatewayRegionalUri.Value, portalUri.Value, managementApiUri.Value, scmUri.Value, developerPortalUri.Value, Optional.ToList(hostnameConfigurations), Optional.ToList(publicIPAddresses), Optional.ToList(privateIPAddresses), publicIPAddressId.Value, Optional.ToNullable(publicNetworkAccess), virtualNetworkConfiguration.Value, Optional.ToList(additionalLocations), Optional.ToDictionary(customProperties), Optional.ToList(certificates), Optional.ToNullable(enableClientCertificate), Optional.ToNullable(natGatewayState), Optional.ToList(outboundPublicIPAddresses), Optional.ToNullable(disableGateway), Optional.ToNullable(virtualNetworkType), apiVersionConstraint.Value, Optional.ToNullable(restore), Optional.ToList(privateEndpointConnections), Optional.ToNullable(platformVersion), publisherEmail.Value, publisherName.Value, Optional.ToDictionary(tags)); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.cs index d20467e7befa..1ffb76594873 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementServicePatch.cs @@ -27,6 +27,7 @@ public ApiManagementServicePatch() AdditionalLocations = new ChangeTrackingList(); CustomProperties = new ChangeTrackingDictionary(); Certificates = new ChangeTrackingList(); + OutboundPublicIPAddresses = new ChangeTrackingList(); PrivateEndpointConnections = new ChangeTrackingList(); Tags = new ChangeTrackingDictionary(); } @@ -57,9 +58,11 @@ public ApiManagementServicePatch() /// Whether or not public endpoint access is allowed for this API Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. /// Virtual network configuration of the API Management service. /// Additional datacenter locations of the API Management service. - /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>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`.</br></br>You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. 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: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>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 1, 2018 and `False` otherwise. Http2 setting's default value is `False`.</br></br>You can disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them.</br> Note: The following ciphers can't be disabled since they are required by internal platform components: TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. /// List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. /// Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. + /// Property can be used to enable NAT Gateway for this API Management service. + /// Outbound public IPV4 address prefixes associated with NAT Gateway deployed service. Available only for Premium SKU on stv2 platform. /// Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. /// The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. /// Control Plane Apis version constraint for the API Management service. @@ -69,7 +72,7 @@ public ApiManagementServicePatch() /// Publisher email. /// Publisher name. /// Resource tags. - internal ApiManagementServicePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ApiManagementServiceSkuProperties sku, ManagedServiceIdentity identity, ETag? etag, IList zones, string notificationSenderEmail, string provisioningState, string targetProvisioningState, DateTimeOffset? createdAtUtc, Uri gatewayUri, Uri gatewayRegionalUri, Uri portalUri, Uri managementApiUri, Uri scmUri, Uri developerPortalUri, IList hostnameConfigurations, IReadOnlyList publicIPAddresses, IReadOnlyList privateIPAddresses, ResourceIdentifier publicIPAddressId, PublicNetworkAccess? publicNetworkAccess, VirtualNetworkConfiguration virtualNetworkConfiguration, IList additionalLocations, IDictionary customProperties, IList certificates, bool? enableClientCertificate, bool? disableGateway, VirtualNetworkType? virtualNetworkType, ApiVersionConstraint apiVersionConstraint, bool? restore, IList privateEndpointConnections, PlatformVersion? platformVersion, string publisherEmail, string publisherName, IDictionary tags) : base(id, name, resourceType, systemData) + internal ApiManagementServicePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ApiManagementServiceSkuProperties sku, ManagedServiceIdentity identity, ETag? etag, IList zones, string notificationSenderEmail, string provisioningState, string targetProvisioningState, DateTimeOffset? createdAtUtc, Uri gatewayUri, Uri gatewayRegionalUri, Uri portalUri, Uri managementApiUri, Uri scmUri, Uri developerPortalUri, IList hostnameConfigurations, IReadOnlyList publicIPAddresses, IReadOnlyList privateIPAddresses, ResourceIdentifier publicIPAddressId, PublicNetworkAccess? publicNetworkAccess, VirtualNetworkConfiguration virtualNetworkConfiguration, IList additionalLocations, IDictionary customProperties, IList certificates, bool? enableClientCertificate, NatGatewayState? natGatewayState, IReadOnlyList outboundPublicIPAddresses, bool? disableGateway, VirtualNetworkType? virtualNetworkType, ApiVersionConstraint apiVersionConstraint, bool? restore, IList privateEndpointConnections, PlatformVersion? platformVersion, string publisherEmail, string publisherName, IDictionary tags) : base(id, name, resourceType, systemData) { Sku = sku; Identity = identity; @@ -95,6 +98,8 @@ internal ApiManagementServicePatch(ResourceIdentifier id, string name, ResourceT CustomProperties = customProperties; Certificates = certificates; EnableClientCertificate = enableClientCertificate; + NatGatewayState = natGatewayState; + OutboundPublicIPAddresses = outboundPublicIPAddresses; DisableGateway = disableGateway; VirtualNetworkType = virtualNetworkType; ApiVersionConstraint = apiVersionConstraint; @@ -148,12 +153,16 @@ internal ApiManagementServicePatch(ResourceIdentifier id, string name, ResourceT public VirtualNetworkConfiguration VirtualNetworkConfiguration { get; set; } /// Additional datacenter locations of the API Management service. public IList AdditionalLocations { get; } - /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>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`.</br></br>You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. 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: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + /// Custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>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 1, 2018 and `False` otherwise. Http2 setting's default value is `False`.</br></br>You can disable any of the following ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them.</br> Note: The following ciphers can't be disabled since they are required by internal platform components: TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256. public IDictionary CustomProperties { get; } /// List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. public IList Certificates { get; } /// Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. public bool? EnableClientCertificate { get; set; } + /// Property can be used to enable NAT Gateway for this API Management service. + public NatGatewayState? NatGatewayState { get; set; } + /// Outbound public IPV4 address prefixes associated with NAT Gateway deployed service. Available only for Premium SKU on stv2 platform. + public IReadOnlyList OutboundPublicIPAddresses { get; } /// Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. public bool? DisableGateway { get; set; } /// The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiSchemaType.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiSchemaType.cs index e9684357728c..63c5b3fec82e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiSchemaType.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiSchemaType.cs @@ -25,7 +25,7 @@ public ApiSchemaType(string value) private const string XmlValue = "xml"; private const string JsonValue = "json"; - /// Xml schema type. + /// XML schema type. public static ApiSchemaType Xml { get; } = new ApiSchemaType(XmlValue); /// Json schema type. public static ApiSchemaType Json { get; } = new ApiSchemaType(JsonValue); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiUpdateContract.Serialization.cs similarity index 98% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiUpdateContract.Serialization.cs index 9657935cef5c..ad4ec06c2498 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiUpdateContract.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiPatch : IUtf8JsonSerializable + public partial class ApiUpdateContract : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiUpdateContract.cs similarity index 95% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiUpdateContract.cs index 5fdc1e6796e9..5a245dfc00fa 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiUpdateContract.cs @@ -12,10 +12,10 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// API update contract details. - public partial class ApiPatch + public partial class ApiUpdateContract { - /// Initializes a new instance of ApiPatch. - public ApiPatch() + /// Initializes a new instance of ApiUpdateContract. + public ApiUpdateContract() { Protocols = new ChangeTrackingList(); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetUpdateParameters.Serialization.cs similarity index 95% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetUpdateParameters.Serialization.cs index b2d763268872..fae512f99577 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetUpdateParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiVersionSetPatch : IUtf8JsonSerializable + public partial class ApiVersionSetUpdateParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetUpdateParameters.cs similarity index 89% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetUpdateParameters.cs index 9e304cbf8b68..3135564318a1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiVersionSetUpdateParameters.cs @@ -8,10 +8,10 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// Parameters to update or create an API Version Set Contract. - public partial class ApiVersionSetPatch + public partial class ApiVersionSetUpdateParameters { - /// Initializes a new instance of ApiVersionSetPatch. - public ApiVersionSetPatch() + /// Initializes a new instance of ApiVersionSetUpdateParameters. + public ApiVersionSetUpdateParameters() { } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.Serialization.cs index 7e80522e5aba..37f97cdea2a3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.Serialization.cs @@ -5,6 +5,7 @@ #nullable disable +using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -25,6 +26,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("openid"u8); writer.WriteObjectValue(OpenId); } + if (Optional.IsCollectionDefined(OAuth2AuthenticationSettings)) + { + writer.WritePropertyName("oAuth2AuthenticationSettings"u8); + writer.WriteStartArray(); + foreach (var item in OAuth2AuthenticationSettings) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(OpenidAuthenticationSettings)) + { + writer.WritePropertyName("openidAuthenticationSettings"u8); + writer.WriteStartArray(); + foreach (var item in OpenidAuthenticationSettings) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } writer.WriteEndObject(); } @@ -36,6 +57,8 @@ internal static AuthenticationSettingsContract DeserializeAuthenticationSettings } Optional oAuth2 = default; Optional openid = default; + Optional> oAuth2AuthenticationSettings = default; + Optional> openidAuthenticationSettings = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("oAuth2"u8)) @@ -58,8 +81,38 @@ internal static AuthenticationSettingsContract DeserializeAuthenticationSettings openid = OpenIdAuthenticationSettingsContract.DeserializeOpenIdAuthenticationSettingsContract(property.Value); continue; } + if (property.NameEquals("oAuth2AuthenticationSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(OAuth2AuthenticationSettingsContract.DeserializeOAuth2AuthenticationSettingsContract(item)); + } + oAuth2AuthenticationSettings = array; + continue; + } + if (property.NameEquals("openidAuthenticationSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(OpenIdAuthenticationSettingsContract.DeserializeOpenIdAuthenticationSettingsContract(item)); + } + openidAuthenticationSettings = array; + continue; + } } - return new AuthenticationSettingsContract(oAuth2.Value, openid.Value); + return new AuthenticationSettingsContract(oAuth2.Value, openid.Value, Optional.ToList(oAuth2AuthenticationSettings), Optional.ToList(openidAuthenticationSettings)); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.cs index bb0ae8079f74..c83b2af57f22 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.cs @@ -5,6 +5,9 @@ #nullable disable +using System.Collections.Generic; +using Azure.Core; + namespace Azure.ResourceManager.ApiManagement.Models { /// API Authentication Settings. @@ -13,20 +16,30 @@ public partial class AuthenticationSettingsContract /// Initializes a new instance of AuthenticationSettingsContract. public AuthenticationSettingsContract() { + OAuth2AuthenticationSettings = new ChangeTrackingList(); + OpenidAuthenticationSettings = new ChangeTrackingList(); } /// Initializes a new instance of AuthenticationSettingsContract. /// OAuth2 Authentication settings. /// OpenID Connect Authentication Settings. - internal AuthenticationSettingsContract(OAuth2AuthenticationSettingsContract oAuth2, OpenIdAuthenticationSettingsContract openId) + /// Collection of OAuth2 authentication settings included into this API. + /// Collection of Open ID Connect authentication settings included into this API. + internal AuthenticationSettingsContract(OAuth2AuthenticationSettingsContract oAuth2, OpenIdAuthenticationSettingsContract openId, IList oAuth2AuthenticationSettings, IList openidAuthenticationSettings) { OAuth2 = oAuth2; OpenId = openId; + OAuth2AuthenticationSettings = oAuth2AuthenticationSettings; + OpenidAuthenticationSettings = openidAuthenticationSettings; } /// OAuth2 Authentication settings. public OAuth2AuthenticationSettingsContract OAuth2 { get; set; } /// OpenID Connect Authentication Settings. public OpenIdAuthenticationSettingsContract OpenId { get; set; } + /// Collection of OAuth2 authentication settings included into this API. + public IList OAuth2AuthenticationSettings { get; } + /// Collection of Open ID Connect authentication settings included into this API. + public IList OpenidAuthenticationSettings { get; } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationAccessPolicyContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationAccessPolicyContractData.Serialization.cs new file mode 100644 index 000000000000..d652277572ac --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationAccessPolicyContractData.Serialization.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class AuthorizationAccessPolicyContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(TenantId)) + { + writer.WritePropertyName("tenantId"u8); + writer.WriteStringValue(TenantId.Value); + } + if (Optional.IsDefined(ObjectId)) + { + writer.WritePropertyName("objectId"u8); + writer.WriteStringValue(ObjectId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static AuthorizationAccessPolicyContractData DeserializeAuthorizationAccessPolicyContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional tenantId = default; + Optional objectId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("tenantId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + tenantId = property0.Value.GetGuid(); + continue; + } + if (property0.NameEquals("objectId"u8)) + { + objectId = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new AuthorizationAccessPolicyContractData(id, name, type, systemData.Value, Optional.ToNullable(tenantId), objectId.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationAccessPolicyListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationAccessPolicyListResult.Serialization.cs new file mode 100644 index 000000000000..9ada5a6e8112 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationAccessPolicyListResult.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class AuthorizationAccessPolicyListResult + { + internal static AuthorizationAccessPolicyListResult DeserializeAuthorizationAccessPolicyListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AuthorizationAccessPolicyContractData.DeserializeAuthorizationAccessPolicyContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new AuthorizationAccessPolicyListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationAccessPolicyListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationAccessPolicyListResult.cs new file mode 100644 index 000000000000..e2e83f54bf76 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationAccessPolicyListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Authorization Access Policy list representation. + internal partial class AuthorizationAccessPolicyListResult + { + /// Initializes a new instance of AuthorizationAccessPolicyListResult. + internal AuthorizationAccessPolicyListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of AuthorizationAccessPolicyListResult. + /// Page values. + /// Total record count number across all pages. + /// Next page link if any. + internal AuthorizationAccessPolicyListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Total record count number across all pages. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationConfirmConsentCodeRequestContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationConfirmConsentCodeRequestContract.Serialization.cs new file mode 100644 index 000000000000..e1382e160b09 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationConfirmConsentCodeRequestContract.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class AuthorizationConfirmConsentCodeRequestContract : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ConsentCode)) + { + writer.WritePropertyName("consentCode"u8); + writer.WriteStringValue(ConsentCode); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationConfirmConsentCodeRequestContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationConfirmConsentCodeRequestContract.cs new file mode 100644 index 000000000000..cd8977f316ef --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationConfirmConsentCodeRequestContract.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Authorization confirm consent code request contract. + public partial class AuthorizationConfirmConsentCodeRequestContract + { + /// Initializes a new instance of AuthorizationConfirmConsentCodeRequestContract. + public AuthorizationConfirmConsentCodeRequestContract() + { + } + + /// The consent code from the authorization server after authorizing and consenting. + public string ConsentCode { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationContractData.Serialization.cs new file mode 100644 index 000000000000..7c84690dd990 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationContractData.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class AuthorizationContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(AuthorizationType)) + { + writer.WritePropertyName("authorizationType"u8); + writer.WriteStringValue(AuthorizationType.Value.ToString()); + } + if (Optional.IsDefined(OAuth2GrantType)) + { + writer.WritePropertyName("oauth2grantType"u8); + writer.WriteStringValue(OAuth2GrantType.Value.ToString()); + } + if (Optional.IsCollectionDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteStartObject(); + foreach (var item in Parameters) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + writer.WriteObjectValue(Error); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static AuthorizationContractData DeserializeAuthorizationContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional authorizationType = default; + Optional oauth2grantType = default; + Optional> parameters = default; + Optional error = default; + Optional status = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("authorizationType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + authorizationType = new AuthorizationType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("oauth2grantType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + oauth2grantType = new OAuth2GrantType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("parameters"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetString()); + } + parameters = dictionary; + continue; + } + if (property0.NameEquals("error"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + error = AuthorizationError.DeserializeAuthorizationError(property0.Value); + continue; + } + if (property0.NameEquals("status"u8)) + { + status = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new AuthorizationContractData(id, name, type, systemData.Value, Optional.ToNullable(authorizationType), Optional.ToNullable(oauth2grantType), Optional.ToDictionary(parameters), error.Value, status.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationError.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationError.Serialization.cs new file mode 100644 index 000000000000..288ab2e5f0b7 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationError.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class AuthorizationError : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Code)) + { + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + writer.WriteEndObject(); + } + + internal static AuthorizationError DeserializeAuthorizationError(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional code = default; + Optional message = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code"u8)) + { + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + } + return new AuthorizationError(code.Value, message.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationError.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationError.cs new file mode 100644 index 000000000000..af963389ace2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationError.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Authorization error details. + public partial class AuthorizationError + { + /// Initializes a new instance of AuthorizationError. + public AuthorizationError() + { + } + + /// Initializes a new instance of AuthorizationError. + /// Error code. + /// Error message. + internal AuthorizationError(string code, string message) + { + Code = code; + Message = message; + } + + /// Error code. + public string Code { get; set; } + /// Error message. + public string Message { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationListResult.Serialization.cs new file mode 100644 index 000000000000..c9dfd11459b3 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationListResult.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class AuthorizationListResult + { + internal static AuthorizationListResult DeserializeAuthorizationListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AuthorizationContractData.DeserializeAuthorizationContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new AuthorizationListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationListResult.cs new file mode 100644 index 000000000000..8edfa4a5a84b --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Authorization list representation. + internal partial class AuthorizationListResult + { + /// Initializes a new instance of AuthorizationListResult. + internal AuthorizationListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of AuthorizationListResult. + /// Page values. + /// Total record count number across all pages. + /// Next page link if any. + internal AuthorizationListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Total record count number across all pages. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginRequestContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginRequestContract.Serialization.cs new file mode 100644 index 000000000000..6e3fab6ca804 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginRequestContract.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class AuthorizationLoginRequestContract : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(PostLoginRedirectUri)) + { + writer.WritePropertyName("postLoginRedirectUrl"u8); + writer.WriteStringValue(PostLoginRedirectUri.AbsoluteUri); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginRequestContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginRequestContract.cs new file mode 100644 index 000000000000..d1348dee02ee --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginRequestContract.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Authorization login request contract. + public partial class AuthorizationLoginRequestContract + { + /// Initializes a new instance of AuthorizationLoginRequestContract. + public AuthorizationLoginRequestContract() + { + } + + /// The redirect URL after login has completed. + public Uri PostLoginRedirectUri { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginResponseContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginResponseContract.Serialization.cs new file mode 100644 index 000000000000..893542009f58 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginResponseContract.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class AuthorizationLoginResponseContract + { + internal static AuthorizationLoginResponseContract DeserializeAuthorizationLoginResponseContract(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional loginLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loginLink"u8)) + { + loginLink = property.Value.GetString(); + continue; + } + } + return new AuthorizationLoginResponseContract(loginLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginResponseContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginResponseContract.cs new file mode 100644 index 000000000000..d6078e8f864b --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationLoginResponseContract.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Authorization login response contract. + public partial class AuthorizationLoginResponseContract + { + /// Initializes a new instance of AuthorizationLoginResponseContract. + internal AuthorizationLoginResponseContract() + { + } + + /// Initializes a new instance of AuthorizationLoginResponseContract. + /// The login link. + internal AuthorizationLoginResponseContract(string loginLink) + { + LoginLink = loginLink; + } + + /// The login link. + public string LoginLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderContractData.Serialization.cs new file mode 100644 index 000000000000..1e05d010b27a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderContractData.Serialization.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class AuthorizationProviderContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(IdentityProvider)) + { + writer.WritePropertyName("identityProvider"u8); + writer.WriteStringValue(IdentityProvider); + } + if (Optional.IsDefined(Oauth2)) + { + writer.WritePropertyName("oauth2"u8); + writer.WriteObjectValue(Oauth2); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static AuthorizationProviderContractData DeserializeAuthorizationProviderContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional displayName = default; + Optional identityProvider = default; + Optional oauth2 = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("identityProvider"u8)) + { + identityProvider = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("oauth2"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + oauth2 = AuthorizationProviderOAuth2Settings.DeserializeAuthorizationProviderOAuth2Settings(property0.Value); + continue; + } + } + continue; + } + } + return new AuthorizationProviderContractData(id, name, type, systemData.Value, displayName.Value, identityProvider.Value, oauth2.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderListResult.Serialization.cs new file mode 100644 index 000000000000..9652e8569219 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderListResult.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class AuthorizationProviderListResult + { + internal static AuthorizationProviderListResult DeserializeAuthorizationProviderListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AuthorizationProviderContractData.DeserializeAuthorizationProviderContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new AuthorizationProviderListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderListResult.cs new file mode 100644 index 000000000000..285d20ef0617 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Authorization Provider list representation. + internal partial class AuthorizationProviderListResult + { + /// Initializes a new instance of AuthorizationProviderListResult. + internal AuthorizationProviderListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of AuthorizationProviderListResult. + /// Page values. + /// Next page link if any. + internal AuthorizationProviderListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2GrantTypes.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2GrantTypes.Serialization.cs new file mode 100644 index 000000000000..10831cf00902 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2GrantTypes.Serialization.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class AuthorizationProviderOAuth2GrantTypes : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(AuthorizationCode)) + { + writer.WritePropertyName("authorizationCode"u8); + writer.WriteStartObject(); + foreach (var item in AuthorizationCode) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(ClientCredentials)) + { + writer.WritePropertyName("clientCredentials"u8); + writer.WriteStartObject(); + foreach (var item in ClientCredentials) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static AuthorizationProviderOAuth2GrantTypes DeserializeAuthorizationProviderOAuth2GrantTypes(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> authorizationCode = default; + Optional> clientCredentials = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("authorizationCode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + authorizationCode = dictionary; + continue; + } + if (property.NameEquals("clientCredentials"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + clientCredentials = dictionary; + continue; + } + } + return new AuthorizationProviderOAuth2GrantTypes(Optional.ToDictionary(authorizationCode), Optional.ToDictionary(clientCredentials)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2GrantTypes.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2GrantTypes.cs new file mode 100644 index 000000000000..289cc7021fe2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2GrantTypes.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Authorization Provider oauth2 grant types settings. + public partial class AuthorizationProviderOAuth2GrantTypes + { + /// Initializes a new instance of AuthorizationProviderOAuth2GrantTypes. + public AuthorizationProviderOAuth2GrantTypes() + { + AuthorizationCode = new ChangeTrackingDictionary(); + ClientCredentials = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of AuthorizationProviderOAuth2GrantTypes. + /// OAuth2 authorization code grant parameters. + /// OAuth2 client credential grant parameters. + internal AuthorizationProviderOAuth2GrantTypes(IDictionary authorizationCode, IDictionary clientCredentials) + { + AuthorizationCode = authorizationCode; + ClientCredentials = clientCredentials; + } + + /// OAuth2 authorization code grant parameters. + public IDictionary AuthorizationCode { get; } + /// OAuth2 client credential grant parameters. + public IDictionary ClientCredentials { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2Settings.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2Settings.Serialization.cs new file mode 100644 index 000000000000..03d1aae044aa --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2Settings.Serialization.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class AuthorizationProviderOAuth2Settings : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(RedirectUri)) + { + writer.WritePropertyName("redirectUrl"u8); + writer.WriteStringValue(RedirectUri.AbsoluteUri); + } + if (Optional.IsDefined(GrantTypes)) + { + writer.WritePropertyName("grantTypes"u8); + writer.WriteObjectValue(GrantTypes); + } + writer.WriteEndObject(); + } + + internal static AuthorizationProviderOAuth2Settings DeserializeAuthorizationProviderOAuth2Settings(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional redirectUri = default; + Optional grantTypes = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("redirectUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + redirectUri = null; + continue; + } + redirectUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("grantTypes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + grantTypes = AuthorizationProviderOAuth2GrantTypes.DeserializeAuthorizationProviderOAuth2GrantTypes(property.Value); + continue; + } + } + return new AuthorizationProviderOAuth2Settings(redirectUri.Value, grantTypes.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2Settings.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2Settings.cs new file mode 100644 index 000000000000..699611f498a9 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationProviderOAuth2Settings.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// OAuth2 settings details. + public partial class AuthorizationProviderOAuth2Settings + { + /// Initializes a new instance of AuthorizationProviderOAuth2Settings. + public AuthorizationProviderOAuth2Settings() + { + } + + /// Initializes a new instance of AuthorizationProviderOAuth2Settings. + /// Redirect URL to be set in the OAuth application. + /// OAuth2 settings. + internal AuthorizationProviderOAuth2Settings(Uri redirectUri, AuthorizationProviderOAuth2GrantTypes grantTypes) + { + RedirectUri = redirectUri; + GrantTypes = grantTypes; + } + + /// Redirect URL to be set in the OAuth application. + public Uri RedirectUri { get; set; } + /// OAuth2 settings. + public AuthorizationProviderOAuth2GrantTypes GrantTypes { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationType.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationType.cs new file mode 100644 index 000000000000..f848a82a2057 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/AuthorizationType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Authorization type options. + public readonly partial struct AuthorizationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AuthorizationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OAuth2Value = "OAuth2"; + + /// OAuth2 authorization type. + public static AuthorizationType OAuth2 { get; } = new AuthorizationType(OAuth2Value); + /// Determines if two values are the same. + public static bool operator ==(AuthorizationType left, AuthorizationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AuthorizationType left, AuthorizationType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AuthorizationType(string value) => new AuthorizationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AuthorizationType other && Equals(other); + /// + public bool Equals(AuthorizationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCircuitBreaker.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCircuitBreaker.Serialization.cs new file mode 100644 index 000000000000..66bd51e2fe93 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCircuitBreaker.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class BackendCircuitBreaker : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Rules)) + { + writer.WritePropertyName("rules"u8); + writer.WriteStartArray(); + foreach (var item in Rules) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static BackendCircuitBreaker DeserializeBackendCircuitBreaker(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> rules = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("rules"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CircuitBreakerRule.DeserializeCircuitBreakerRule(item)); + } + rules = array; + continue; + } + } + return new BackendCircuitBreaker(Optional.ToList(rules)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCircuitBreaker.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCircuitBreaker.cs new file mode 100644 index 000000000000..4f2bf40894b4 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/BackendCircuitBreaker.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The configuration of the backend circuit breaker. + internal partial class BackendCircuitBreaker + { + /// Initializes a new instance of BackendCircuitBreaker. + public BackendCircuitBreaker() + { + Rules = new ChangeTrackingList(); + } + + /// Initializes a new instance of BackendCircuitBreaker. + /// The rules for tripping the backend. + internal BackendCircuitBreaker(IList rules) + { + Rules = rules; + } + + /// The rules for tripping the backend. + public IList Rules { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerFailureCondition.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerFailureCondition.Serialization.cs new file mode 100644 index 000000000000..d572bf98d738 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerFailureCondition.Serialization.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class CircuitBreakerFailureCondition : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(Percentage)) + { + writer.WritePropertyName("percentage"u8); + writer.WriteNumberValue(Percentage.Value); + } + if (Optional.IsDefined(Interval)) + { + writer.WritePropertyName("interval"u8); + writer.WriteStringValue(Interval.Value, "P"); + } + if (Optional.IsCollectionDefined(StatusCodeRanges)) + { + writer.WritePropertyName("statusCodeRanges"u8); + writer.WriteStartArray(); + foreach (var item in StatusCodeRanges) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ErrorReasons)) + { + writer.WritePropertyName("errorReasons"u8); + writer.WriteStartArray(); + foreach (var item in ErrorReasons) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static CircuitBreakerFailureCondition DeserializeCircuitBreakerFailureCondition(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional count = default; + Optional percentage = default; + Optional interval = default; + Optional> statusCodeRanges = default; + Optional> errorReasons = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("percentage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + percentage = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("interval"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + interval = property.Value.GetTimeSpan("P"); + continue; + } + if (property.NameEquals("statusCodeRanges"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FailureStatusCodeRange.DeserializeFailureStatusCodeRange(item)); + } + statusCodeRanges = array; + continue; + } + if (property.NameEquals("errorReasons"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + errorReasons = array; + continue; + } + } + return new CircuitBreakerFailureCondition(Optional.ToNullable(count), Optional.ToNullable(percentage), Optional.ToNullable(interval), Optional.ToList(statusCodeRanges), Optional.ToList(errorReasons)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerFailureCondition.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerFailureCondition.cs new file mode 100644 index 000000000000..bea2093c6e5c --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerFailureCondition.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The trip conditions of the circuit breaker. + public partial class CircuitBreakerFailureCondition + { + /// Initializes a new instance of CircuitBreakerFailureCondition. + public CircuitBreakerFailureCondition() + { + StatusCodeRanges = new ChangeTrackingList(); + ErrorReasons = new ChangeTrackingList(); + } + + /// Initializes a new instance of CircuitBreakerFailureCondition. + /// The threshold for opening the circuit. + /// The threshold for opening the circuit. + /// The interval during which the failures are counted. + /// The status code ranges which are considered as failure. + /// The error reasons which are considered as failure. + internal CircuitBreakerFailureCondition(long? count, long? percentage, TimeSpan? interval, IList statusCodeRanges, IList errorReasons) + { + Count = count; + Percentage = percentage; + Interval = interval; + StatusCodeRanges = statusCodeRanges; + ErrorReasons = errorReasons; + } + + /// The threshold for opening the circuit. + public long? Count { get; set; } + /// The threshold for opening the circuit. + public long? Percentage { get; set; } + /// The interval during which the failures are counted. + public TimeSpan? Interval { get; set; } + /// The status code ranges which are considered as failure. + public IList StatusCodeRanges { get; } + /// The error reasons which are considered as failure. + public IList ErrorReasons { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerRule.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerRule.Serialization.cs new file mode 100644 index 000000000000..7efcaea11e63 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerRule.Serialization.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class CircuitBreakerRule : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(FailureCondition)) + { + writer.WritePropertyName("failureCondition"u8); + writer.WriteObjectValue(FailureCondition); + } + if (Optional.IsDefined(TripDuration)) + { + writer.WritePropertyName("tripDuration"u8); + writer.WriteStringValue(TripDuration.Value, "P"); + } + writer.WriteEndObject(); + } + + internal static CircuitBreakerRule DeserializeCircuitBreakerRule(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional failureCondition = default; + Optional tripDuration = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("failureCondition"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + failureCondition = CircuitBreakerFailureCondition.DeserializeCircuitBreakerFailureCondition(property.Value); + continue; + } + if (property.NameEquals("tripDuration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + tripDuration = property.Value.GetTimeSpan("P"); + continue; + } + } + return new CircuitBreakerRule(name.Value, failureCondition.Value, Optional.ToNullable(tripDuration)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerRule.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerRule.cs new file mode 100644 index 000000000000..a560e56122dc --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/CircuitBreakerRule.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Rule configuration to trip the backend. + public partial class CircuitBreakerRule + { + /// Initializes a new instance of CircuitBreakerRule. + public CircuitBreakerRule() + { + } + + /// Initializes a new instance of CircuitBreakerRule. + /// The rule name. + /// The conditions for tripping the circuit breaker. + /// The duration for which the circuit will be tripped. + internal CircuitBreakerRule(string name, CircuitBreakerFailureCondition failureCondition, TimeSpan? tripDuration) + { + Name = name; + FailureCondition = failureCondition; + TripDuration = tripDuration; + } + + /// The rule name. + public string Name { get; set; } + /// The conditions for tripping the circuit breaker. + public CircuitBreakerFailureCondition FailureCondition { get; set; } + /// The duration for which the circuit will be tripped. + public TimeSpan? TripDuration { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationContractData.Serialization.cs new file mode 100644 index 000000000000..3b207fc7f945 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationContractData.Serialization.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class DocumentationContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Title)) + { + writer.WritePropertyName("title"u8); + writer.WriteStringValue(Title); + } + if (Optional.IsDefined(Content)) + { + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static DocumentationContractData DeserializeDocumentationContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional title = default; + Optional content = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("title"u8)) + { + title = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("content"u8)) + { + content = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new DocumentationContractData(id, name, type, systemData.Value, title.Value, content.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationContractPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationContractPatch.Serialization.cs new file mode 100644 index 000000000000..7619a2d67315 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationContractPatch.Serialization.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class DocumentationContractPatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Title)) + { + writer.WritePropertyName("title"u8); + writer.WriteStringValue(Title); + } + if (Optional.IsDefined(Content)) + { + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationContractPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationContractPatch.cs new file mode 100644 index 000000000000..be0b6edf9ab8 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationContractPatch.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Documentation update contract details. + public partial class DocumentationContractPatch + { + /// Initializes a new instance of DocumentationContractPatch. + public DocumentationContractPatch() + { + } + + /// documentation title. + public string Title { get; set; } + /// Markdown documentation content. + public string Content { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationListResult.Serialization.cs new file mode 100644 index 000000000000..aea695113f32 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationListResult.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class DocumentationListResult + { + internal static DocumentationListResult DeserializeDocumentationListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentationContractData.DeserializeDocumentationContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DocumentationListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationListResult.cs new file mode 100644 index 000000000000..ab191948a4e5 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/DocumentationListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Documentation list representation. + internal partial class DocumentationListResult + { + /// Initializes a new instance of DocumentationListResult. + internal DocumentationListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DocumentationListResult. + /// Page values. + /// Next page link if any. + internal DocumentationListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/FailureStatusCodeRange.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/FailureStatusCodeRange.Serialization.cs new file mode 100644 index 000000000000..1b8895e23ad2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/FailureStatusCodeRange.Serialization.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class FailureStatusCodeRange : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Min)) + { + writer.WritePropertyName("min"u8); + writer.WriteNumberValue(Min.Value); + } + if (Optional.IsDefined(Max)) + { + writer.WritePropertyName("max"u8); + writer.WriteNumberValue(Max.Value); + } + writer.WriteEndObject(); + } + + internal static FailureStatusCodeRange DeserializeFailureStatusCodeRange(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional min = default; + Optional max = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("min"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + min = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("max"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + max = property.Value.GetInt32(); + continue; + } + } + return new FailureStatusCodeRange(Optional.ToNullable(min), Optional.ToNullable(max)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/FailureStatusCodeRange.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/FailureStatusCodeRange.cs new file mode 100644 index 000000000000..bfbd3107f52f --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/FailureStatusCodeRange.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The failure http status code range. + public partial class FailureStatusCodeRange + { + /// Initializes a new instance of FailureStatusCodeRange. + public FailureStatusCodeRange() + { + } + + /// Initializes a new instance of FailureStatusCodeRange. + /// The minimum http status code. + /// The maximum http status code. + internal FailureStatusCodeRange(int? min, int? max) + { + Min = min; + Max = max; + } + + /// The minimum http status code. + public int? Min { get; set; } + /// The maximum http status code. + public int? Max { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupCreateParameters.Serialization.cs similarity index 94% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupCreateParameters.Serialization.cs index 69851709ceac..5957bef1b9b2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupCreateParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementGroupPatch : IUtf8JsonSerializable + public partial class GroupCreateParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupCreateParameters.cs similarity index 80% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupCreateParameters.cs index 94fc8970c977..52a7dd0f0258 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupCreateParameters.cs @@ -8,10 +8,10 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// Parameters supplied to the Create Group operation. - public partial class ApiManagementGroupCreateOrUpdateContent + public partial class GroupCreateParameters { - /// Initializes a new instance of ApiManagementGroupCreateOrUpdateContent. - public ApiManagementGroupCreateOrUpdateContent() + /// Initializes a new instance of GroupCreateParameters. + public GroupCreateParameters() { } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupUpdateParameters.Serialization.cs similarity index 93% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupUpdateParameters.Serialization.cs index 72bfd9337aff..0d4a63f8bd06 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupUpdateParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementGroupCreateOrUpdateContent : IUtf8JsonSerializable + public partial class GroupUpdateParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupUpdateParameters.cs similarity index 84% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupUpdateParameters.cs index c2a6aeb36c87..1050fff880ff 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementGroupPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/GroupUpdateParameters.cs @@ -8,10 +8,10 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// Parameters supplied to the Update Group operation. - public partial class ApiManagementGroupPatch + public partial class GroupUpdateParameters { - /// Initializes a new instance of ApiManagementGroupPatch. - public ApiManagementGroupPatch() + /// Initializes a new instance of GroupUpdateParameters. + public GroupUpdateParameters() { } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameConfiguration.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameConfiguration.cs index 1c271a26f333..b65f65bde6c5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameConfiguration.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/HostnameConfiguration.cs @@ -32,7 +32,7 @@ public HostnameConfiguration(HostnameType hostnameType, string hostName) /// System or User Assigned Managed identity clientId as generated by Azure AD, which has GET access to the keyVault containing the SSL certificate. /// Base64 Encoded certificate. /// Certificate Password. - /// 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. + /// 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 gateway Hostname Type. /// Specify true to always negotiate client certificate on the hostname. Default Value is false. /// Certificate information. /// Certificate Source. @@ -64,7 +64,7 @@ internal HostnameConfiguration(HostnameType hostnameType, string hostName, Uri k public string EncodedCertificate { get; set; } /// Certificate Password. public string CertificatePassword { get; set; } - /// 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. + /// 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 gateway Hostname Type. public bool? IsDefaultSslBindingEnabled { get; set; } /// Specify true to always negotiate client certificate on the hostname. Default Value is false. public bool? IsClientCertificateNegotiationEnabled { get; set; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueCreateContract.Serialization.cs similarity index 93% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueCreateContract.Serialization.cs index 214fa3010cd5..ce24fee32c86 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueCreateContract.Serialization.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementNamedValueCreateOrUpdateContent : IUtf8JsonSerializable + public partial class NamedValueCreateContract : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -53,7 +53,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ApiManagementNamedValueCreateOrUpdateContent DeserializeApiManagementNamedValueCreateOrUpdateContent(JsonElement element) + internal static NamedValueCreateContract DeserializeNamedValueCreateContract(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { @@ -153,7 +153,7 @@ internal static ApiManagementNamedValueCreateOrUpdateContent DeserializeApiManag continue; } } - return new ApiManagementNamedValueCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToList(tags), Optional.ToNullable(secret), displayName.Value, value.Value, keyVault.Value); + return new NamedValueCreateContract(id, name, type, systemData.Value, Optional.ToList(tags), Optional.ToNullable(secret), displayName.Value, value.Value, keyVault.Value); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueCreateContract.cs similarity index 79% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueCreateContract.cs index cab1bd1e6240..b4bb4b560ab8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValueCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueCreateContract.cs @@ -12,15 +12,15 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// NamedValue details. - public partial class ApiManagementNamedValueCreateOrUpdateContent : ResourceData + public partial class NamedValueCreateContract : ResourceData { - /// Initializes a new instance of ApiManagementNamedValueCreateOrUpdateContent. - public ApiManagementNamedValueCreateOrUpdateContent() + /// Initializes a new instance of NamedValueCreateContract. + public NamedValueCreateContract() { Tags = new ChangeTrackingList(); } - /// Initializes a new instance of ApiManagementNamedValueCreateOrUpdateContent. + /// Initializes a new instance of NamedValueCreateContract. /// The id. /// The name. /// The resourceType. @@ -30,7 +30,7 @@ public ApiManagementNamedValueCreateOrUpdateContent() /// Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. /// Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. /// KeyVault location details of the namedValue. - internal ApiManagementNamedValueCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList tags, bool? isSecret, string displayName, string value, KeyVaultContractCreateProperties keyVault) : base(id, name, resourceType, systemData) + internal NamedValueCreateContract(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList tags, bool? isSecret, string displayName, string value, KeyVaultContractCreateProperties keyVault) : base(id, name, resourceType, systemData) { Tags = tags; IsSecret = isSecret; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueUpdateParameters.Serialization.cs similarity index 95% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueUpdateParameters.Serialization.cs index 7482ee164940..274fbd1456f9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueUpdateParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementNamedValuePatch : IUtf8JsonSerializable + public partial class NamedValueUpdateParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueUpdateParameters.cs similarity index 86% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueUpdateParameters.cs index c4a8d7a37e6c..c591dbfaa55c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementNamedValuePatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NamedValueUpdateParameters.cs @@ -11,10 +11,10 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// NamedValue update Parameters. - public partial class ApiManagementNamedValuePatch + public partial class NamedValueUpdateParameters { - /// Initializes a new instance of ApiManagementNamedValuePatch. - public ApiManagementNamedValuePatch() + /// Initializes a new instance of NamedValueUpdateParameters. + public NamedValueUpdateParameters() { Tags = new ChangeTrackingList(); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NatGatewayState.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NatGatewayState.cs new file mode 100644 index 000000000000..8756121a42d9 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/NatGatewayState.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Property can be used to enable NAT Gateway for this API Management service. + public readonly partial struct NatGatewayState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NatGatewayState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Nat Gateway is enabled for the service. + public static NatGatewayState Enabled { get; } = new NatGatewayState(EnabledValue); + /// Nat Gateway is disabled for the service. + public static NatGatewayState Disabled { get; } = new NatGatewayState(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(NatGatewayState left, NatGatewayState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NatGatewayState left, NatGatewayState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NatGatewayState(string value) => new NatGatewayState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NatGatewayState other && Equals(other); + /// + public bool Equals(NatGatewayState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OAuth2GrantType.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OAuth2GrantType.cs new file mode 100644 index 000000000000..acc48bc79ee3 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OAuth2GrantType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// OAuth2 grant type options. + public readonly partial struct OAuth2GrantType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OAuth2GrantType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AuthorizationCodeValue = "AuthorizationCode"; + private const string ClientCredentialsValue = "ClientCredentials"; + + /// Authorization Code grant. + public static OAuth2GrantType AuthorizationCode { get; } = new OAuth2GrantType(AuthorizationCodeValue); + /// Client Credential grant. + public static OAuth2GrantType ClientCredentials { get; } = new OAuth2GrantType(ClientCredentialsValue); + /// Determines if two values are the same. + public static bool operator ==(OAuth2GrantType left, OAuth2GrantType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OAuth2GrantType left, OAuth2GrantType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator OAuth2GrantType(string value) => new OAuth2GrantType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OAuth2GrantType other && Equals(other); + /// + public bool Equals(OAuth2GrantType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationUpdateContract.Serialization.cs similarity index 97% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationUpdateContract.Serialization.cs index 1520341d83a8..3a9518309272 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationUpdateContract.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiOperationPatch : IUtf8JsonSerializable + public partial class OperationUpdateContract : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationUpdateContract.cs similarity index 90% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationUpdateContract.cs index 1b38170f4b87..5f6c2191e70e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiOperationPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/OperationUpdateContract.cs @@ -11,10 +11,10 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// API Operation Update Contract details. - public partial class ApiOperationPatch + public partial class OperationUpdateContract { - /// Initializes a new instance of ApiOperationPatch. - public ApiOperationPatch() + /// Initializes a new instance of OperationUpdateContract. + public OperationUpdateContract() { TemplateParameters = new ChangeTrackingList(); Responses = new ChangeTrackingList(); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PlatformVersion.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PlatformVersion.cs index de22d200ae69..74a23c849443 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PlatformVersion.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PlatformVersion.cs @@ -26,6 +26,7 @@ public PlatformVersion(string value) private const string Stv1Value = "stv1"; private const string Stv2Value = "stv2"; private const string Mtv1Value = "mtv1"; + private const string Stv21Value = "stv2.1"; /// Platform version cannot be determined, as compute platform is not deployed. public static PlatformVersion Undetermined { get; } = new PlatformVersion(UndeterminedValue); @@ -35,6 +36,8 @@ public PlatformVersion(string value) public static PlatformVersion Stv2 { get; } = new PlatformVersion(Stv2Value); /// Platform running the service on Multi Tenant V1 platform. public static PlatformVersion Mtv1 { get; } = new PlatformVersion(Mtv1Value); + /// Platform running the service on Single Tenant V2 platform on newer Hardware. + public static PlatformVersion Stv21 { get; } = new PlatformVersion(Stv21Value); /// Determines if two values are the same. public static bool operator ==(PlatformVersion left, PlatformVersion right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyContentFormat.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyContentFormat.cs index 7d40ffeb473a..3c1b480e45f8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyContentFormat.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyContentFormat.cs @@ -29,11 +29,11 @@ public PolicyContentFormat(string value) /// The contents are inline and Content type is an XML document. public static PolicyContentFormat Xml { get; } = new PolicyContentFormat(XmlValue); - /// The policy XML document is hosted on a http endpoint accessible from the API Management service. + /// The policy XML document is hosted on a HTTP endpoint accessible from the API Management service. public static PolicyContentFormat XmlLink { get; } = new PolicyContentFormat(XmlLinkValue); /// The contents are inline and Content type is a non XML encoded policy document. public static PolicyContentFormat RawXml { get; } = new PolicyContentFormat(RawXmlValue); - /// The policy document is not Xml encoded and is hosted on a http endpoint accessible from the API Management service. + /// The policy document is not XML encoded and is hosted on a HTTP endpoint accessible from the API Management service. public static PolicyContentFormat RawXmlLink { get; } = new PolicyContentFormat(RawXmlLinkValue); /// Determines if two values are the same. public static bool operator ==(PolicyContentFormat left, PolicyContentFormat right) => left.Equals(right); diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionListResult.cs index 63ae26c58e45..f34fa7882e89 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyDescriptionListResult.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - /// Descriptions of APIM policies. + /// Descriptions of API Management policies. internal partial class PolicyDescriptionListResult { /// Initializes a new instance of PolicyDescriptionListResult. @@ -20,7 +20,7 @@ internal PolicyDescriptionListResult() } /// Initializes a new instance of PolicyDescriptionListResult. - /// Descriptions of APIM policies. + /// Descriptions of API Management policies. /// Total record count number. internal PolicyDescriptionListResult(IReadOnlyList value, long? count) { @@ -28,7 +28,7 @@ internal PolicyDescriptionListResult(IReadOnlyList Descriptions of APIM policies. + /// Descriptions of API Management policies. public IReadOnlyList Value { get; } /// Total record count number. public long? Count { get; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentContentFormat.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentContentFormat.cs new file mode 100644 index 000000000000..ea423856a7f8 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentContentFormat.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The PolicyFragmentContentFormat. + public readonly partial struct PolicyFragmentContentFormat : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PolicyFragmentContentFormat(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string XmlValue = "xml"; + private const string RawxmlValue = "rawxml"; + + /// The contents are inline and Content type is an XML document. + public static PolicyFragmentContentFormat Xml { get; } = new PolicyFragmentContentFormat(XmlValue); + /// The contents are inline and Content type is a non XML encoded policy document. + public static PolicyFragmentContentFormat Rawxml { get; } = new PolicyFragmentContentFormat(RawxmlValue); + /// Determines if two values are the same. + public static bool operator ==(PolicyFragmentContentFormat left, PolicyFragmentContentFormat right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PolicyFragmentContentFormat left, PolicyFragmentContentFormat right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PolicyFragmentContentFormat(string value) => new PolicyFragmentContentFormat(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PolicyFragmentContentFormat other && Equals(other); + /// + public bool Equals(PolicyFragmentContentFormat other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentContractData.Serialization.cs new file mode 100644 index 000000000000..954bbd0635fe --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentContractData.Serialization.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class PolicyFragmentContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Format)) + { + writer.WritePropertyName("format"u8); + writer.WriteStringValue(Format.Value.ToString()); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static PolicyFragmentContractData DeserializePolicyFragmentContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional value = default; + Optional description = default; + Optional format = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("value"u8)) + { + value = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("format"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + format = new PolicyFragmentContentFormat(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new PolicyFragmentContractData(id, name, type, systemData.Value, value.Value, description.Value, Optional.ToNullable(format)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentListResult.Serialization.cs new file mode 100644 index 000000000000..fda2fe24e28e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentListResult.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class PolicyFragmentListResult + { + internal static PolicyFragmentListResult DeserializePolicyFragmentListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PolicyFragmentContractData.DeserializePolicyFragmentContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new PolicyFragmentListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentListResult.cs new file mode 100644 index 000000000000..2beaa8c976b0 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PolicyFragmentListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The response of the get policy fragments operation. + internal partial class PolicyFragmentListResult + { + /// Initializes a new instance of PolicyFragmentListResult. + internal PolicyFragmentListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of PolicyFragmentListResult. + /// Policy fragment contract value. + /// Total record count number. + /// Next page link if any. + internal PolicyFragmentListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Policy fragment contract value. + public IReadOnlyList Value { get; } + /// Total record count number. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigContractData.Serialization.cs new file mode 100644 index 000000000000..143f60badd9b --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigContractData.Serialization.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class PortalConfigContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(EnableBasicAuth)) + { + writer.WritePropertyName("enableBasicAuth"u8); + writer.WriteBooleanValue(EnableBasicAuth.Value); + } + if (Optional.IsDefined(Signin)) + { + writer.WritePropertyName("signin"u8); + writer.WriteObjectValue(Signin); + } + if (Optional.IsDefined(Signup)) + { + writer.WritePropertyName("signup"u8); + writer.WriteObjectValue(Signup); + } + if (Optional.IsDefined(Delegation)) + { + writer.WritePropertyName("delegation"u8); + writer.WriteObjectValue(Delegation); + } + if (Optional.IsDefined(Cors)) + { + writer.WritePropertyName("cors"u8); + writer.WriteObjectValue(Cors); + } + if (Optional.IsDefined(Csp)) + { + writer.WritePropertyName("csp"u8); + writer.WriteObjectValue(Csp); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static PortalConfigContractData DeserializePortalConfigContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional enableBasicAuth = default; + Optional signin = default; + Optional signup = default; + Optional delegation = default; + Optional cors = default; + Optional csp = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("enableBasicAuth"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + enableBasicAuth = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("signin"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + signin = PortalConfigPropertiesSignin.DeserializePortalConfigPropertiesSignin(property0.Value); + continue; + } + if (property0.NameEquals("signup"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + signup = PortalConfigPropertiesSignup.DeserializePortalConfigPropertiesSignup(property0.Value); + continue; + } + if (property0.NameEquals("delegation"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + delegation = PortalConfigDelegationProperties.DeserializePortalConfigDelegationProperties(property0.Value); + continue; + } + if (property0.NameEquals("cors"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + cors = PortalConfigCorsProperties.DeserializePortalConfigCorsProperties(property0.Value); + continue; + } + if (property0.NameEquals("csp"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + csp = PortalConfigCspProperties.DeserializePortalConfigCspProperties(property0.Value); + continue; + } + } + continue; + } + } + return new PortalConfigContractData(id, name, type, systemData.Value, Optional.ToNullable(enableBasicAuth), signin.Value, signup.Value, delegation.Value, cors.Value, csp.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCorsProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCorsProperties.Serialization.cs new file mode 100644 index 000000000000..7b401ab49c16 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCorsProperties.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class PortalConfigCorsProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(AllowedOrigins)) + { + writer.WritePropertyName("allowedOrigins"u8); + writer.WriteStartArray(); + foreach (var item in AllowedOrigins) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static PortalConfigCorsProperties DeserializePortalConfigCorsProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> allowedOrigins = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("allowedOrigins"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + allowedOrigins = array; + continue; + } + } + return new PortalConfigCorsProperties(Optional.ToList(allowedOrigins)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCorsProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCorsProperties.cs new file mode 100644 index 000000000000..8eef66d436f7 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCorsProperties.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The developer portal Cross-Origin Resource Sharing (CORS) settings. + internal partial class PortalConfigCorsProperties + { + /// Initializes a new instance of PortalConfigCorsProperties. + public PortalConfigCorsProperties() + { + AllowedOrigins = new ChangeTrackingList(); + } + + /// Initializes a new instance of PortalConfigCorsProperties. + /// Allowed origins, e.g. `https://trusted.com`. + internal PortalConfigCorsProperties(IList allowedOrigins) + { + AllowedOrigins = allowedOrigins; + } + + /// Allowed origins, e.g. `https://trusted.com`. + public IList AllowedOrigins { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCspProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCspProperties.Serialization.cs new file mode 100644 index 000000000000..f7607ab132cb --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCspProperties.Serialization.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class PortalConfigCspProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Mode)) + { + writer.WritePropertyName("mode"u8); + writer.WriteStringValue(Mode.Value.ToString()); + } + if (Optional.IsCollectionDefined(ReportUri)) + { + writer.WritePropertyName("reportUri"u8); + writer.WriteStartArray(); + foreach (var item in ReportUri) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.AbsoluteUri); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AllowedSources)) + { + writer.WritePropertyName("allowedSources"u8); + writer.WriteStartArray(); + foreach (var item in AllowedSources) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static PortalConfigCspProperties DeserializePortalConfigCspProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional mode = default; + Optional> reportUri = default; + Optional> allowedSources = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("mode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + mode = new PortalSettingsCspMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("reportUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(new Uri(item.GetString())); + } + } + reportUri = array; + continue; + } + if (property.NameEquals("allowedSources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + allowedSources = array; + continue; + } + } + return new PortalConfigCspProperties(Optional.ToNullable(mode), Optional.ToList(reportUri), Optional.ToList(allowedSources)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCspProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCspProperties.cs new file mode 100644 index 000000000000..2b34917ba4bb --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigCspProperties.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The developer portal Content Security Policy (CSP) settings. + public partial class PortalConfigCspProperties + { + /// Initializes a new instance of PortalConfigCspProperties. + public PortalConfigCspProperties() + { + ReportUri = new ChangeTrackingList(); + AllowedSources = new ChangeTrackingList(); + } + + /// Initializes a new instance of PortalConfigCspProperties. + /// The mode of the developer portal Content Security Policy (CSP). + /// The URLs used by the browser to report CSP violations. + /// Allowed sources, e.g. `*.trusted.com`, `trusted.com`, `https://`. + internal PortalConfigCspProperties(PortalSettingsCspMode? mode, IList reportUri, IList allowedSources) + { + Mode = mode; + ReportUri = reportUri; + AllowedSources = allowedSources; + } + + /// The mode of the developer portal Content Security Policy (CSP). + public PortalSettingsCspMode? Mode { get; set; } + /// The URLs used by the browser to report CSP violations. + public IList ReportUri { get; } + /// Allowed sources, e.g. `*.trusted.com`, `trusted.com`, `https://`. + public IList AllowedSources { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigDelegationProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigDelegationProperties.Serialization.cs new file mode 100644 index 000000000000..2e33c9d8bdf5 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigDelegationProperties.Serialization.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class PortalConfigDelegationProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(DelegateRegistration)) + { + writer.WritePropertyName("delegateRegistration"u8); + writer.WriteBooleanValue(DelegateRegistration.Value); + } + if (Optional.IsDefined(DelegateSubscription)) + { + writer.WritePropertyName("delegateSubscription"u8); + writer.WriteBooleanValue(DelegateSubscription.Value); + } + if (Optional.IsDefined(DelegationUri)) + { + writer.WritePropertyName("delegationUrl"u8); + writer.WriteStringValue(DelegationUri.AbsoluteUri); + } + if (Optional.IsDefined(ValidationKey)) + { + writer.WritePropertyName("validationKey"u8); + writer.WriteStringValue(ValidationKey); + } + writer.WriteEndObject(); + } + + internal static PortalConfigDelegationProperties DeserializePortalConfigDelegationProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional delegateRegistration = default; + Optional delegateSubscription = default; + Optional delegationUri = default; + Optional validationKey = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("delegateRegistration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + delegateRegistration = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("delegateSubscription"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + delegateSubscription = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("delegationUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + delegationUri = null; + continue; + } + delegationUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("validationKey"u8)) + { + validationKey = property.Value.GetString(); + continue; + } + } + return new PortalConfigDelegationProperties(Optional.ToNullable(delegateRegistration), Optional.ToNullable(delegateSubscription), delegationUri.Value, validationKey.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigDelegationProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigDelegationProperties.cs new file mode 100644 index 000000000000..1e12488f90dc --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigDelegationProperties.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The PortalConfigDelegationProperties. + public partial class PortalConfigDelegationProperties + { + /// Initializes a new instance of PortalConfigDelegationProperties. + public PortalConfigDelegationProperties() + { + } + + /// Initializes a new instance of PortalConfigDelegationProperties. + /// Enable or disable delegation for user registration. + /// Enable or disable delegation for product subscriptions. + /// A delegation endpoint URL. + /// A base64-encoded validation key to ensure requests originate from Azure API Management service. + internal PortalConfigDelegationProperties(bool? delegateRegistration, bool? delegateSubscription, Uri delegationUri, string validationKey) + { + DelegateRegistration = delegateRegistration; + DelegateSubscription = delegateSubscription; + DelegationUri = delegationUri; + ValidationKey = validationKey; + } + + /// Enable or disable delegation for user registration. + public bool? DelegateRegistration { get; set; } + /// Enable or disable delegation for product subscriptions. + public bool? DelegateSubscription { get; set; } + /// A delegation endpoint URL. + public Uri DelegationUri { get; set; } + /// A base64-encoded validation key to ensure requests originate from Azure API Management service. + public string ValidationKey { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigListResult.Serialization.cs new file mode 100644 index 000000000000..02538b705d55 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigListResult.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class PortalConfigListResult + { + internal static PortalConfigListResult DeserializePortalConfigListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PortalConfigContractData.DeserializePortalConfigContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new PortalConfigListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigListResult.cs new file mode 100644 index 000000000000..fa9cd2890e07 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The collection of the developer portal configurations. + internal partial class PortalConfigListResult + { + /// Initializes a new instance of PortalConfigListResult. + internal PortalConfigListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of PortalConfigListResult. + /// The developer portal configurations. + /// Next page link if any. + internal PortalConfigListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The developer portal configurations. + public IReadOnlyList Value { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignin.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignin.Serialization.cs new file mode 100644 index 000000000000..d291e66f6d6e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignin.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class PortalConfigPropertiesSignin : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Require)) + { + writer.WritePropertyName("require"u8); + writer.WriteBooleanValue(Require.Value); + } + writer.WriteEndObject(); + } + + internal static PortalConfigPropertiesSignin DeserializePortalConfigPropertiesSignin(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional require = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("require"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + require = property.Value.GetBoolean(); + continue; + } + } + return new PortalConfigPropertiesSignin(Optional.ToNullable(require)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignin.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignin.cs new file mode 100644 index 000000000000..322c6a765649 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignin.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The PortalConfigPropertiesSignin. + internal partial class PortalConfigPropertiesSignin + { + /// Initializes a new instance of PortalConfigPropertiesSignin. + public PortalConfigPropertiesSignin() + { + } + + /// Initializes a new instance of PortalConfigPropertiesSignin. + /// Redirect anonymous users to the sign-in page. + internal PortalConfigPropertiesSignin(bool? require) + { + Require = require; + } + + /// Redirect anonymous users to the sign-in page. + public bool? Require { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignup.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignup.Serialization.cs new file mode 100644 index 000000000000..81aa6c66f17e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignup.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class PortalConfigPropertiesSignup : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TermsOfService)) + { + writer.WritePropertyName("termsOfService"u8); + writer.WriteObjectValue(TermsOfService); + } + writer.WriteEndObject(); + } + + internal static PortalConfigPropertiesSignup DeserializePortalConfigPropertiesSignup(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional termsOfService = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("termsOfService"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + termsOfService = PortalConfigTermsOfServiceProperties.DeserializePortalConfigTermsOfServiceProperties(property.Value); + continue; + } + } + return new PortalConfigPropertiesSignup(termsOfService.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignup.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignup.cs new file mode 100644 index 000000000000..72ca13a0aa3d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigPropertiesSignup.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The PortalConfigPropertiesSignup. + internal partial class PortalConfigPropertiesSignup + { + /// Initializes a new instance of PortalConfigPropertiesSignup. + public PortalConfigPropertiesSignup() + { + } + + /// Initializes a new instance of PortalConfigPropertiesSignup. + /// Terms of service settings. + internal PortalConfigPropertiesSignup(PortalConfigTermsOfServiceProperties termsOfService) + { + TermsOfService = termsOfService; + } + + /// Terms of service settings. + public PortalConfigTermsOfServiceProperties TermsOfService { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigTermsOfServiceProperties.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigTermsOfServiceProperties.Serialization.cs new file mode 100644 index 000000000000..2af55ea99067 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigTermsOfServiceProperties.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class PortalConfigTermsOfServiceProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Text)) + { + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + } + if (Optional.IsDefined(RequireConsent)) + { + writer.WritePropertyName("requireConsent"u8); + writer.WriteBooleanValue(RequireConsent.Value); + } + writer.WriteEndObject(); + } + + internal static PortalConfigTermsOfServiceProperties DeserializePortalConfigTermsOfServiceProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional text = default; + Optional requireConsent = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("requireConsent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + requireConsent = property.Value.GetBoolean(); + continue; + } + } + return new PortalConfigTermsOfServiceProperties(text.Value, Optional.ToNullable(requireConsent)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigTermsOfServiceProperties.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigTermsOfServiceProperties.cs new file mode 100644 index 000000000000..68784e4691e1 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalConfigTermsOfServiceProperties.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Terms of service contract properties. + public partial class PortalConfigTermsOfServiceProperties + { + /// Initializes a new instance of PortalConfigTermsOfServiceProperties. + public PortalConfigTermsOfServiceProperties() + { + } + + /// Initializes a new instance of PortalConfigTermsOfServiceProperties. + /// A terms of service text. + /// Ask user for consent to the terms of service. + internal PortalConfigTermsOfServiceProperties(string text, bool? requireConsent) + { + Text = text; + RequireConsent = requireConsent; + } + + /// A terms of service text. + public string Text { get; set; } + /// Ask user for consent to the terms of service. + public bool? RequireConsent { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsCspMode.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsCspMode.cs new file mode 100644 index 000000000000..a8207a74e07a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsCspMode.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The mode of the developer portal Content Security Policy (CSP). + public readonly partial struct PortalSettingsCspMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PortalSettingsCspMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "enabled"; + private const string DisabledValue = "disabled"; + private const string ReportOnlyValue = "reportOnly"; + + /// The browser will block requests not matching allowed origins. + public static PortalSettingsCspMode Enabled { get; } = new PortalSettingsCspMode(EnabledValue); + /// The browser will not apply the origin restrictions. + public static PortalSettingsCspMode Disabled { get; } = new PortalSettingsCspMode(DisabledValue); + /// The browser will report requests not matching allowed origins without blocking them. + public static PortalSettingsCspMode ReportOnly { get; } = new PortalSettingsCspMode(ReportOnlyValue); + /// Determines if two values are the same. + public static bool operator ==(PortalSettingsCspMode left, PortalSettingsCspMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PortalSettingsCspMode left, PortalSettingsCspMode right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PortalSettingsCspMode(string value) => new PortalSettingsCspMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PortalSettingsCspMode other && Equals(other); + /// + public bool Equals(PortalSettingsCspMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsListResult.cs index e7d87aa1f974..7644d8039b35 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsListResult.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/PortalSettingsListResult.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - /// Descriptions of APIM policies. + /// Descriptions of API Management policies. internal partial class PortalSettingsListResult { /// Initializes a new instance of PortalSettingsListResult. @@ -20,7 +20,7 @@ internal PortalSettingsListResult() } /// Initializes a new instance of PortalSettingsListResult. - /// Descriptions of APIM policies. + /// Descriptions of API Management policies. /// Total record count number. internal PortalSettingsListResult(IReadOnlyList value, long? count) { @@ -28,7 +28,7 @@ internal PortalSettingsListResult(IReadOnlyList valu Count = count; } - /// Descriptions of APIM policies. + /// Descriptions of API Management policies. public IReadOnlyList Value { get; } /// Total record count number. public long? Count { get; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiLinkContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiLinkContractData.Serialization.cs new file mode 100644 index 000000000000..5458e643cded --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiLinkContractData.Serialization.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class ProductApiLinkContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ApiId)) + { + writer.WritePropertyName("apiId"u8); + writer.WriteStringValue(ApiId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ProductApiLinkContractData DeserializeProductApiLinkContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional apiId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("apiId"u8)) + { + apiId = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new ProductApiLinkContractData(id, name, type, systemData.Value, apiId.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiLinkListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiLinkListResult.Serialization.cs new file mode 100644 index 000000000000..5ad13a168abb --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiLinkListResult.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class ProductApiLinkListResult + { + internal static ProductApiLinkListResult DeserializeProductApiLinkListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ProductApiLinkContractData.DeserializeProductApiLinkContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ProductApiLinkListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiLinkListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiLinkListResult.cs new file mode 100644 index 000000000000..5f9894559dd2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductApiLinkListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Product-API link list representation. + internal partial class ProductApiLinkListResult + { + /// Initializes a new instance of ProductApiLinkListResult. + internal ProductApiLinkListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ProductApiLinkListResult. + /// Page values. + /// Total record count number across all pages. + /// Next page link if any. + internal ProductApiLinkListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Total record count number across all pages. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupLinkContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupLinkContractData.Serialization.cs new file mode 100644 index 000000000000..a9dc6f2f1247 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupLinkContractData.Serialization.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class ProductGroupLinkContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(GroupId)) + { + writer.WritePropertyName("groupId"u8); + writer.WriteStringValue(GroupId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ProductGroupLinkContractData DeserializeProductGroupLinkContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional groupId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("groupId"u8)) + { + groupId = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new ProductGroupLinkContractData(id, name, type, systemData.Value, groupId.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupLinkListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupLinkListResult.Serialization.cs new file mode 100644 index 000000000000..f22730b2c1e2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupLinkListResult.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class ProductGroupLinkListResult + { + internal static ProductGroupLinkListResult DeserializeProductGroupLinkListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ProductGroupLinkListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupLinkListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupLinkListResult.cs new file mode 100644 index 000000000000..b5bc50a668cf --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductGroupLinkListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Product-group link list representation. + internal partial class ProductGroupLinkListResult + { + /// Initializes a new instance of ProductGroupLinkListResult. + internal ProductGroupLinkListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ProductGroupLinkListResult. + /// Page values. + /// Total record count number across all pages. + /// Next page link if any. + internal ProductGroupLinkListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Total record count number across all pages. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductUpdateParameters.Serialization.cs similarity index 96% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductUpdateParameters.Serialization.cs index 8e2983618917..e44906a92093 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductUpdateParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementProductPatch : IUtf8JsonSerializable + public partial class ProductUpdateParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductUpdateParameters.cs similarity index 92% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductUpdateParameters.cs index 105d7fa6ca88..1a0232875dbc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementProductPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ProductUpdateParameters.cs @@ -8,10 +8,10 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// Product Update parameters. - public partial class ApiManagementProductPatch + public partial class ProductUpdateParameters { - /// Initializes a new instance of ApiManagementProductPatch. - public ApiManagementProductPatch() + /// Initializes a new instance of ProductUpdateParameters. + public ProductUpdateParameters() { } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportRecordContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportRecordContract.cs index aa712d6e24ce..d142ec69e286 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportRecordContract.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ReportRecordContract.cs @@ -36,7 +36,7 @@ internal ReportRecordContract() /// Subscription identifier path. /subscriptions/{subscriptionId}. /// Number of successful calls. This includes calls returning HttpStatusCode <= 301 and HttpStatusCode.NotModified and HttpStatusCode.TemporaryRedirect. /// Number of calls blocked due to invalid credentials. This includes calls returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and HttpStatusCode.TooManyRequests. - /// Number of calls failed due to proxy or backend errors. This includes calls returning HttpStatusCode.BadRequest(400) and any Code between HttpStatusCode.InternalServerError (500) and 600. + /// 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. /// Number of other calls. /// Total number of calls. /// Bandwidth consumed. @@ -109,7 +109,7 @@ internal ReportRecordContract(string name, DateTimeOffset? timestamp, string int public int? CallCountSuccess { get; } /// Number of calls blocked due to invalid credentials. This includes calls returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and HttpStatusCode.TooManyRequests. public int? CallCountBlocked { get; } - /// Number of calls failed due to proxy or backend errors. This includes calls returning HttpStatusCode.BadRequest(400) and any Code between HttpStatusCode.InternalServerError (500) and 600. + /// 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. public int? CallCountFailed { get; } /// Number of other calls. public int? CallCountOther { get; } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverContractData.Serialization.cs new file mode 100644 index 000000000000..d195c26b0449 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverContractData.Serialization.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class ResolverContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Path)) + { + writer.WritePropertyName("path"u8); + writer.WriteStringValue(Path); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ResolverContractData DeserializeResolverContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional displayName = default; + Optional path = default; + Optional description = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("path"u8)) + { + path = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new ResolverContractData(id, name, type, systemData.Value, displayName.Value, path.Value, description.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverContractPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverContractPatch.Serialization.cs new file mode 100644 index 000000000000..bbd86e09f5a2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverContractPatch.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class ResolverContractPatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Path)) + { + writer.WritePropertyName("path"u8); + writer.WriteStringValue(Path); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverContractPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverContractPatch.cs new file mode 100644 index 000000000000..99d9c60be1a7 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverContractPatch.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// GraphQL API Resolver Update Contract details. + public partial class ResolverContractPatch + { + /// Initializes a new instance of ResolverContractPatch. + public ResolverContractPatch() + { + } + + /// Resolver Name. + public string DisplayName { get; set; } + /// Path is type/field being resolved. + public string Path { get; set; } + /// Description of the resolver. May include HTML formatting tags. + public string Description { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverListResult.Serialization.cs new file mode 100644 index 000000000000..9a7c8d9b5418 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverListResult.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class ResolverListResult + { + internal static ResolverListResult DeserializeResolverListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResolverContractData.DeserializeResolverContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ResolverListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverListResult.cs new file mode 100644 index 000000000000..e55868baa385 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResolverListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Resolver list representation. + internal partial class ResolverListResult + { + /// Initializes a new instance of ResolverListResult. + internal ResolverListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ResolverListResult. + /// Page values. + /// Total record count number across all pages. + /// Next page link if any. + internal ResolverListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Total record count number across all pages. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceCollectionValueItem.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceCollectionValueItem.Serialization.cs new file mode 100644 index 000000000000..a6adc0184de9 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceCollectionValueItem.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class ResourceCollectionValueItem : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static ResourceCollectionValueItem DeserializeResourceCollectionValueItem(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new ResourceCollectionValueItem(id, name, type, systemData.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceCollectionValueItem.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceCollectionValueItem.cs new file mode 100644 index 000000000000..ddabdfd04755 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceCollectionValueItem.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// The ResourceCollectionValueItem. + public partial class ResourceCollectionValueItem : ResourceData + { + /// Initializes a new instance of ResourceCollectionValueItem. + public ResourceCollectionValueItem() + { + } + + /// Initializes a new instance of ResourceCollectionValueItem. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + internal ResourceCollectionValueItem(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData) : base(id, name, resourceType, systemData) + { + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceListResult.Serialization.cs new file mode 100644 index 000000000000..98f0215cff30 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceListResult.Serialization.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class ResourceListResult + { + internal static ResourceListResult DeserializeResourceListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResourceCollectionValueItem.DeserializeResourceCollectionValueItem(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ResourceListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceListResult.cs new file mode 100644 index 000000000000..c0c13e5193e0 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ResourceListResult.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// A collection of resources. + internal partial class ResourceListResult + { + /// Initializes a new instance of ResourceListResult. + internal ResourceListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ResourceListResult. + /// A collection of resources. + /// Total record count number. + /// Next page link if any. + internal ResourceListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// A collection of resources. + public IReadOnlyList Value { get; } + /// Total record count number. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionCreateParameters.Serialization.cs similarity index 95% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionCreateParameters.Serialization.cs index ef510d594bc3..7d02fe2453c2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionCreateParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementSubscriptionCreateOrUpdateContent : IUtf8JsonSerializable + public partial class SubscriptionCreateParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionCreateParameters.cs similarity index 88% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionCreateParameters.cs index 0cb7cae73974..d4abf813627e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionCreateOrUpdateContent.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionCreateParameters.cs @@ -8,10 +8,10 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// Subscription create details. - public partial class ApiManagementSubscriptionCreateOrUpdateContent + public partial class SubscriptionCreateParameters { - /// Initializes a new instance of ApiManagementSubscriptionCreateOrUpdateContent. - public ApiManagementSubscriptionCreateOrUpdateContent() + /// Initializes a new instance of SubscriptionCreateParameters. + public SubscriptionCreateParameters() { } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionUpdateParameters.Serialization.cs similarity index 96% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.Serialization.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionUpdateParameters.Serialization.cs index 6836cff6f88c..fe34bd009df8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.Serialization.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionUpdateParameters.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ApiManagement.Models { - public partial class ApiManagementSubscriptionPatch : IUtf8JsonSerializable + public partial class SubscriptionUpdateParameters : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionUpdateParameters.cs similarity index 91% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionUpdateParameters.cs index 3a5872d19a88..118609af0228 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/ApiManagementSubscriptionPatch.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/SubscriptionUpdateParameters.cs @@ -10,10 +10,10 @@ namespace Azure.ResourceManager.ApiManagement.Models { /// Subscription update details. - public partial class ApiManagementSubscriptionPatch + public partial class SubscriptionUpdateParameters { - /// Initializes a new instance of ApiManagementSubscriptionPatch. - public ApiManagementSubscriptionPatch() + /// Initializes a new instance of SubscriptionUpdateParameters. + public SubscriptionUpdateParameters() { } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagApiLinkContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagApiLinkContractData.Serialization.cs new file mode 100644 index 000000000000..21d01c7172ec --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagApiLinkContractData.Serialization.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class TagApiLinkContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ApiId)) + { + writer.WritePropertyName("apiId"u8); + writer.WriteStringValue(ApiId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static TagApiLinkContractData DeserializeTagApiLinkContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional apiId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("apiId"u8)) + { + apiId = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new TagApiLinkContractData(id, name, type, systemData.Value, apiId.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagApiLinkListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagApiLinkListResult.Serialization.cs new file mode 100644 index 000000000000..20c082b9f51c --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagApiLinkListResult.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class TagApiLinkListResult + { + internal static TagApiLinkListResult DeserializeTagApiLinkListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TagApiLinkContractData.DeserializeTagApiLinkContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new TagApiLinkListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagApiLinkListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagApiLinkListResult.cs new file mode 100644 index 000000000000..ea7acfd899ea --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagApiLinkListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Tag-API link list representation. + internal partial class TagApiLinkListResult + { + /// Initializes a new instance of TagApiLinkListResult. + internal TagApiLinkListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of TagApiLinkListResult. + /// Page values. + /// Total record count number across all pages. + /// Next page link if any. + internal TagApiLinkListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Total record count number across all pages. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagOperationLinkContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagOperationLinkContractData.Serialization.cs new file mode 100644 index 000000000000..5d710c11f17d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagOperationLinkContractData.Serialization.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class TagOperationLinkContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(OperationId)) + { + writer.WritePropertyName("operationId"u8); + writer.WriteStringValue(OperationId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static TagOperationLinkContractData DeserializeTagOperationLinkContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional operationId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("operationId"u8)) + { + operationId = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new TagOperationLinkContractData(id, name, type, systemData.Value, operationId.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagOperationLinkListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagOperationLinkListResult.Serialization.cs new file mode 100644 index 000000000000..2961d06a7b1f --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagOperationLinkListResult.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class TagOperationLinkListResult + { + internal static TagOperationLinkListResult DeserializeTagOperationLinkListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TagOperationLinkContractData.DeserializeTagOperationLinkContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new TagOperationLinkListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagOperationLinkListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagOperationLinkListResult.cs new file mode 100644 index 000000000000..0d4d030d2e54 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagOperationLinkListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Tag-operation link list representation. + internal partial class TagOperationLinkListResult + { + /// Initializes a new instance of TagOperationLinkListResult. + internal TagOperationLinkListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of TagOperationLinkListResult. + /// Page values. + /// Total record count number across all pages. + /// Next page link if any. + internal TagOperationLinkListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Total record count number across all pages. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagProductLinkContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagProductLinkContractData.Serialization.cs new file mode 100644 index 000000000000..d31647e1cd27 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagProductLinkContractData.Serialization.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class TagProductLinkContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ProductId)) + { + writer.WritePropertyName("productId"u8); + writer.WriteStringValue(ProductId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static TagProductLinkContractData DeserializeTagProductLinkContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional productId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("productId"u8)) + { + productId = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new TagProductLinkContractData(id, name, type, systemData.Value, productId.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagProductLinkListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagProductLinkListResult.Serialization.cs new file mode 100644 index 000000000000..d5ba5c799aa9 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagProductLinkListResult.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class TagProductLinkListResult + { + internal static TagProductLinkListResult DeserializeTagProductLinkListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TagProductLinkContractData.DeserializeTagProductLinkContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new TagProductLinkListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagProductLinkListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagProductLinkListResult.cs new file mode 100644 index 000000000000..58e8dad64620 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TagProductLinkListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged Tag-product link list representation. + internal partial class TagProductLinkListResult + { + /// Initializes a new instance of TagProductLinkListResult. + internal TagProductLinkListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of TagProductLinkListResult. + /// Page values. + /// Total record count number across all pages. + /// Next page link if any. + internal TagProductLinkListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Total record count number across all pages. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TranslateRequiredQueryParametersConduct.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TranslateRequiredQueryParametersConduct.cs new file mode 100644 index 000000000000..602e0a069174 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/TranslateRequiredQueryParametersConduct.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Strategy of translating required query parameters to template ones. By default has value 'template'. Possible values: 'template', 'query'. + public readonly partial struct TranslateRequiredQueryParametersConduct : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TranslateRequiredQueryParametersConduct(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TemplateValue = "template"; + private const string QueryValue = "query"; + + /// Translates required query parameters to template ones. Is a default value. + public static TranslateRequiredQueryParametersConduct Template { get; } = new TranslateRequiredQueryParametersConduct(TemplateValue); + /// Leaves required query parameters as they are (no translation done). + public static TranslateRequiredQueryParametersConduct Query { get; } = new TranslateRequiredQueryParametersConduct(QueryValue); + /// Determines if two values are the same. + public static bool operator ==(TranslateRequiredQueryParametersConduct left, TranslateRequiredQueryParametersConduct right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TranslateRequiredQueryParametersConduct left, TranslateRequiredQueryParametersConduct right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TranslateRequiredQueryParametersConduct(string value) => new TranslateRequiredQueryParametersConduct(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TranslateRequiredQueryParametersConduct other && Equals(other); + /// + public bool Equals(TranslateRequiredQueryParametersConduct other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiContractData.Serialization.cs new file mode 100644 index 000000000000..3f1d965df89f --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiContractData.Serialization.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class WikiContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Documents)) + { + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static WikiContractData DeserializeWikiContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional> documents = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("documents"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(WikiDocumentationContract.DeserializeWikiDocumentationContract(item)); + } + documents = array; + continue; + } + } + continue; + } + } + return new WikiContractData(id, name, type, systemData.Value, Optional.ToList(documents)); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiDocumentationContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiDocumentationContract.Serialization.cs new file mode 100644 index 000000000000..74e7b7e40431 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiDocumentationContract.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class WikiDocumentationContract : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(DocumentationId)) + { + writer.WritePropertyName("documentationId"u8); + writer.WriteStringValue(DocumentationId); + } + writer.WriteEndObject(); + } + + internal static WikiDocumentationContract DeserializeWikiDocumentationContract(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional documentationId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("documentationId"u8)) + { + documentationId = property.Value.GetString(); + continue; + } + } + return new WikiDocumentationContract(documentationId.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiDocumentationContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiDocumentationContract.cs new file mode 100644 index 000000000000..1ef9ececb1f4 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiDocumentationContract.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Wiki documentation details. + public partial class WikiDocumentationContract + { + /// Initializes a new instance of WikiDocumentationContract. + public WikiDocumentationContract() + { + } + + /// Initializes a new instance of WikiDocumentationContract. + /// Documentation Identifier. + internal WikiDocumentationContract(string documentationId) + { + DocumentationId = documentationId; + } + + /// Documentation Identifier. + public string DocumentationId { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiUpdateContract.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiUpdateContract.Serialization.cs new file mode 100644 index 000000000000..9358fc04f6c1 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiUpdateContract.Serialization.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + public partial class WikiUpdateContract : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Documents)) + { + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiUpdateContract.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiUpdateContract.cs new file mode 100644 index 000000000000..78710135cafd --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WikiUpdateContract.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Wiki update contract details. + public partial class WikiUpdateContract + { + /// Initializes a new instance of WikiUpdateContract. + public WikiUpdateContract() + { + Documents = new ChangeTrackingList(); + } + + /// Collection wiki documents included into this wiki. + public IList Documents { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WorkspaceContractData.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WorkspaceContractData.Serialization.cs new file mode 100644 index 000000000000..e08ee395221f --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WorkspaceContractData.Serialization.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + public partial class WorkspaceContractData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static WorkspaceContractData DeserializeWorkspaceContractData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional displayName = default; + Optional description = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new WorkspaceContractData(id, name, type, systemData.Value, displayName.Value, description.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WorkspaceListResult.Serialization.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WorkspaceListResult.Serialization.cs new file mode 100644 index 000000000000..0652c0201a60 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WorkspaceListResult.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + internal partial class WorkspaceListResult + { + internal static WorkspaceListResult DeserializeWorkspaceListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional count = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WorkspaceContractData.DeserializeWorkspaceContractData(item)); + } + value = array; + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new WorkspaceListResult(Optional.ToList(value), Optional.ToNullable(count), nextLink.Value); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WorkspaceListResult.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WorkspaceListResult.cs new file mode 100644 index 000000000000..f695912e3a35 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Models/WorkspaceListResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Models +{ + /// Paged workspace list representation. + internal partial class WorkspaceListResult + { + /// Initializes a new instance of WorkspaceListResult. + internal WorkspaceListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of WorkspaceListResult. + /// Page values. + /// Total record count number across all pages. + /// Next page link if any. + internal WorkspaceListResult(IReadOnlyList value, long? count, string nextLink) + { + Value = value; + Count = count; + NextLink = nextLink; + } + + /// Page values. + public IReadOnlyList Value { get; } + /// Total record count number across all pages. + public long? Count { get; } + /// Next page link if any. + public string NextLink { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PolicyFragmentContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PolicyFragmentContractData.cs new file mode 100644 index 000000000000..761a908448b8 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PolicyFragmentContractData.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the PolicyFragmentContract data model. + /// Policy fragment contract details. + /// + public partial class PolicyFragmentContractData : ResourceData + { + /// Initializes a new instance of PolicyFragmentContractData. + public PolicyFragmentContractData() + { + } + + /// Initializes a new instance of PolicyFragmentContractData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Contents of the policy fragment. + /// Policy fragment description. + /// Format of the policy fragment content. + internal PolicyFragmentContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string value, string description, PolicyFragmentContentFormat? format) : base(id, name, resourceType, systemData) + { + Value = value; + Description = description; + Format = format; + } + + /// Contents of the policy fragment. + public string Value { get; set; } + /// Policy fragment description. + public string Description { get; set; } + /// Format of the policy fragment content. + public PolicyFragmentContentFormat? Format { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PortalConfigContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PortalConfigContractCollection.cs new file mode 100644 index 000000000000..5b02d9949a99 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PortalConfigContractCollection.cs @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetPortalConfigContracts method from an instance of . + /// + public partial class PortalConfigContractCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _portalConfigContractPortalConfigClientDiagnostics; + private readonly PortalConfigRestOperations _portalConfigContractPortalConfigRestClient; + + /// Initializes a new instance of the class for mocking. + protected PortalConfigContractCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal PortalConfigContractCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _portalConfigContractPortalConfigClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", PortalConfigContractResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(PortalConfigContractResource.ResourceType, out string portalConfigContractPortalConfigApiVersion); + _portalConfigContractPortalConfigRestClient = new PortalConfigRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, portalConfigContractPortalConfigApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ApiManagementServiceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementServiceResource.ResourceType), nameof(id)); + } + + /// + /// Create or update the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Portal configuration identifier. + /// 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. + /// Update the developer portal configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string portalConfigId, ETag ifMatch, PortalConfigContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _portalConfigContractPortalConfigRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portalConfigId, ifMatch, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new PortalConfigContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Portal configuration identifier. + /// 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. + /// Update the developer portal configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string portalConfigId, ETag ifMatch, PortalConfigContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _portalConfigContractPortalConfigRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portalConfigId, ifMatch, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new PortalConfigContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Get + /// + /// + /// + /// Portal configuration identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string portalConfigId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractCollection.Get"); + scope.Start(); + try + { + var response = await _portalConfigContractPortalConfigRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portalConfigId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PortalConfigContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Get + /// + /// + /// + /// Portal configuration identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string portalConfigId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractCollection.Get"); + scope.Start(); + try + { + var response = _portalConfigContractPortalConfigRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portalConfigId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PortalConfigContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the developer portal configurations. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs + /// + /// + /// Operation Id + /// PortalConfig_ListByService + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _portalConfigContractPortalConfigRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new PortalConfigContractResource(Client, PortalConfigContractData.DeserializePortalConfigContractData(e)), _portalConfigContractPortalConfigClientDiagnostics, Pipeline, "PortalConfigContractCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Lists the developer portal configurations. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs + /// + /// + /// Operation Id + /// PortalConfig_ListByService + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _portalConfigContractPortalConfigRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return PageableHelpers.CreatePageable(FirstPageRequest, null, e => new PortalConfigContractResource(Client, PortalConfigContractData.DeserializePortalConfigContractData(e)), _portalConfigContractPortalConfigClientDiagnostics, Pipeline, "PortalConfigContractCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Get + /// + /// + /// + /// Portal configuration identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string portalConfigId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractCollection.Exists"); + scope.Start(); + try + { + var response = await _portalConfigContractPortalConfigRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portalConfigId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Get + /// + /// + /// + /// Portal configuration identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string portalConfigId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractCollection.Exists"); + scope.Start(); + try + { + var response = _portalConfigContractPortalConfigRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portalConfigId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PortalConfigContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PortalConfigContractData.cs new file mode 100644 index 000000000000..4f4073e61a37 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PortalConfigContractData.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the PortalConfigContract data model. + /// The developer portal configuration contract. + /// + public partial class PortalConfigContractData : ResourceData + { + /// Initializes a new instance of PortalConfigContractData. + public PortalConfigContractData() + { + } + + /// Initializes a new instance of PortalConfigContractData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Enable or disable Basic authentication method. + /// + /// + /// The developer portal delegation settings. + /// The developer portal Cross-Origin Resource Sharing (CORS) settings. + /// The developer portal Content Security Policy (CSP) settings. + internal PortalConfigContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? enableBasicAuth, PortalConfigPropertiesSignin signin, PortalConfigPropertiesSignup signup, PortalConfigDelegationProperties delegation, PortalConfigCorsProperties cors, PortalConfigCspProperties csp) : base(id, name, resourceType, systemData) + { + EnableBasicAuth = enableBasicAuth; + Signin = signin; + Signup = signup; + Delegation = delegation; + Cors = cors; + Csp = csp; + } + + /// Enable or disable Basic authentication method. + public bool? EnableBasicAuth { get; set; } + /// Gets or sets the signin. + internal PortalConfigPropertiesSignin Signin { get; set; } + /// Redirect anonymous users to the sign-in page. + public bool? Require + { + get => Signin is null ? default : Signin.Require; + set + { + if (Signin is null) + Signin = new PortalConfigPropertiesSignin(); + Signin.Require = value; + } + } + + /// Gets or sets the signup. + internal PortalConfigPropertiesSignup Signup { get; set; } + /// Terms of service settings. + public PortalConfigTermsOfServiceProperties SignupTermsOfService + { + get => Signup is null ? default : Signup.TermsOfService; + set + { + if (Signup is null) + Signup = new PortalConfigPropertiesSignup(); + Signup.TermsOfService = value; + } + } + + /// The developer portal delegation settings. + public PortalConfigDelegationProperties Delegation { get; set; } + /// The developer portal Cross-Origin Resource Sharing (CORS) settings. + internal PortalConfigCorsProperties Cors { get; set; } + /// Allowed origins, e.g. `https://trusted.com`. + public IList CorsAllowedOrigins + { + get + { + if (Cors is null) + Cors = new PortalConfigCorsProperties(); + return Cors.AllowedOrigins; + } + } + + /// The developer portal Content Security Policy (CSP) settings. + public PortalConfigCspProperties Csp { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PortalConfigContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PortalConfigContractResource.cs new file mode 100644 index 000000000000..6d0540e9c9e5 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/PortalConfigContractResource.cs @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a PortalConfigContract along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetPortalConfigContractResource method. + /// Otherwise you can get one from its parent resource using the GetPortalConfigContract method. + /// + public partial class PortalConfigContractResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _portalConfigContractPortalConfigClientDiagnostics; + private readonly PortalConfigRestOperations _portalConfigContractPortalConfigRestClient; + private readonly PortalConfigContractData _data; + + /// Initializes a new instance of the class for mocking. + protected PortalConfigContractResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal PortalConfigContractResource(ArmClient client, PortalConfigContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal PortalConfigContractResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _portalConfigContractPortalConfigClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string portalConfigContractPortalConfigApiVersion); + _portalConfigContractPortalConfigRestClient = new PortalConfigRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, portalConfigContractPortalConfigApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/portalconfigs"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PortalConfigContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractResource.Get"); + scope.Start(); + try + { + var response = await _portalConfigContractPortalConfigRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PortalConfigContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractResource.Get"); + scope.Start(); + try + { + var response = _portalConfigContractPortalConfigRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PortalConfigContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Update + /// + /// + /// + /// 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. + /// Update the developer portal configuration. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, PortalConfigContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractResource.Update"); + scope.Start(); + try + { + var response = await _portalConfigContractPortalConfigRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PortalConfigContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_Update + /// + /// + /// + /// 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. + /// Update the developer portal configuration. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, PortalConfigContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractResource.Update"); + scope.Start(); + try + { + var response = _portalConfigContractPortalConfigRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken); + return Response.FromValue(new PortalConfigContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _portalConfigContractPortalConfigRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the developer portal configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalconfigs/{portalConfigId} + /// + /// + /// Operation Id + /// PortalConfig_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _portalConfigContractPortalConfigClientDiagnostics.CreateScope("PortalConfigContractResource.GetEntityTag"); + scope.Start(); + try + { + var response = _portalConfigContractPortalConfigRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ProductApiLinkContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ProductApiLinkContractData.cs new file mode 100644 index 000000000000..6a0954ed7c03 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ProductApiLinkContractData.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the ProductApiLinkContract data model. + /// Product-API link details. + /// + public partial class ProductApiLinkContractData : ResourceData + { + /// Initializes a new instance of ProductApiLinkContractData. + public ProductApiLinkContractData() + { + } + + /// Initializes a new instance of ProductApiLinkContractData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Full resource Id of an API. + internal ProductApiLinkContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string apiId) : base(id, name, resourceType, systemData) + { + ApiId = apiId; + } + + /// Full resource Id of an API. + public string ApiId { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ProductGroupLinkContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ProductGroupLinkContractData.cs new file mode 100644 index 000000000000..72b5953b2d5d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ProductGroupLinkContractData.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the ProductGroupLinkContract data model. + /// Product-group link details. + /// + public partial class ProductGroupLinkContractData : ResourceData + { + /// Initializes a new instance of ProductGroupLinkContractData. + public ProductGroupLinkContractData() + { + } + + /// Initializes a new instance of ProductGroupLinkContractData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Full resource Id of a group. + internal ProductGroupLinkContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId) : base(id, name, resourceType, systemData) + { + GroupId = groupId; + } + + /// Full resource Id of a group. + public string GroupId { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ResolverContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ResolverContractCollection.cs new file mode 100644 index 000000000000..f9ce86a37da6 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ResolverContractCollection.cs @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetResolverContracts method from an instance of . + /// + public partial class ResolverContractCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _resolverContractGraphQLApiResolverClientDiagnostics; + private readonly GraphQLApiResolverRestOperations _resolverContractGraphQLApiResolverRestClient; + + /// Initializes a new instance of the class for mocking. + protected ResolverContractCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ResolverContractCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _resolverContractGraphQLApiResolverClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResolverContractResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResolverContractResource.ResourceType, out string resolverContractGraphQLApiResolverApiVersion); + _resolverContractGraphQLApiResolverRestClient = new GraphQLApiResolverRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, resolverContractGraphQLApiResolverApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiResource.ResourceType), nameof(id)); + } + + /// + /// Creates a new resolver in the GraphQL API or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string resolverId, ResolverContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _resolverContractGraphQLApiResolverRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resolverId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ResolverContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new resolver in the GraphQL API or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string resolverId, ResolverContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _resolverContractGraphQLApiResolverRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resolverId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ResolverContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the GraphQL API Resolver specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Get + /// + /// + /// + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractCollection.Get"); + scope.Start(); + try + { + var response = await _resolverContractGraphQLApiResolverRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resolverId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ResolverContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the GraphQL API Resolver specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Get + /// + /// + /// + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractCollection.Get"); + scope.Start(); + try + { + var response = _resolverContractGraphQLApiResolverRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resolverId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ResolverContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the resolvers for the specified GraphQL API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers + /// + /// + /// Operation Id + /// GraphQLApiResolver_ListByApi + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _resolverContractGraphQLApiResolverRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _resolverContractGraphQLApiResolverRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ResolverContractResource(Client, ResolverContractData.DeserializeResolverContractData(e)), _resolverContractGraphQLApiResolverClientDiagnostics, Pipeline, "ResolverContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the resolvers for the specified GraphQL API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers + /// + /// + /// Operation Id + /// GraphQLApiResolver_ListByApi + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _resolverContractGraphQLApiResolverRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _resolverContractGraphQLApiResolverRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ResolverContractResource(Client, ResolverContractData.DeserializeResolverContractData(e)), _resolverContractGraphQLApiResolverClientDiagnostics, Pipeline, "ResolverContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Get + /// + /// + /// + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractCollection.Exists"); + scope.Start(); + try + { + var response = await _resolverContractGraphQLApiResolverRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resolverId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Get + /// + /// + /// + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractCollection.Exists"); + scope.Start(); + try + { + var response = _resolverContractGraphQLApiResolverRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resolverId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ResolverContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ResolverContractData.cs new file mode 100644 index 000000000000..9d3fa2c9ae3a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ResolverContractData.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the ResolverContract data model. + /// GraphQL API Resolver details. + /// + public partial class ResolverContractData : ResourceData + { + /// Initializes a new instance of ResolverContractData. + public ResolverContractData() + { + } + + /// Initializes a new instance of ResolverContractData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resolver Name. + /// Path is type/field being resolved. + /// Description of the resolver. May include HTML formatting tags. + internal ResolverContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string path, string description) : base(id, name, resourceType, systemData) + { + DisplayName = displayName; + Path = path; + Description = description; + } + + /// Resolver Name. + public string DisplayName { get; set; } + /// Path is type/field being resolved. + public string Path { get; set; } + /// Description of the resolver. May include HTML formatting tags. + public string Description { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ResolverContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ResolverContractResource.cs new file mode 100644 index 000000000000..6099d1111970 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ResolverContractResource.cs @@ -0,0 +1,405 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ResolverContract along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetResolverContractResource method. + /// Otherwise you can get one from its parent resource using the GetResolverContract method. + /// + public partial class ResolverContractResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _resolverContractGraphQLApiResolverClientDiagnostics; + private readonly GraphQLApiResolverRestOperations _resolverContractGraphQLApiResolverRestClient; + private readonly ResolverContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ResolverContractResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ResolverContractResource(ArmClient client, ResolverContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ResolverContractResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _resolverContractGraphQLApiResolverClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string resolverContractGraphQLApiResolverApiVersion); + _resolverContractGraphQLApiResolverRestClient = new GraphQLApiResolverRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, resolverContractGraphQLApiResolverApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/apis/resolvers"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ResolverContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of ServiceApiResolverPolicyResources in the ResolverContract. + /// An object representing collection of ServiceApiResolverPolicyResources and their operations over a ServiceApiResolverPolicyResource. + public virtual ServiceApiResolverPolicyCollection GetServiceApiResolverPolicies() + { + return GetCachedClient(Client => new ServiceApiResolverPolicyCollection(Client, Id)); + } + + /// + /// Get the policy configuration at the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetServiceApiResolverPolicyAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return await GetServiceApiResolverPolicies().GetAsync(policyId, format, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the policy configuration at the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetServiceApiResolverPolicy(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return GetServiceApiResolverPolicies().Get(policyId, format, cancellationToken); + } + + /// + /// Gets the details of the GraphQL API Resolver specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractResource.Get"); + scope.Start(); + try + { + var response = await _resolverContractGraphQLApiResolverRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ResolverContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the GraphQL API Resolver specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractResource.Get"); + scope.Start(); + try + { + var response = _resolverContractGraphQLApiResolverRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ResolverContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified resolver in the GraphQL API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractResource.Delete"); + scope.Start(); + try + { + var response = await _resolverContractGraphQLApiResolverRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified resolver in the GraphQL API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractResource.Delete"); + scope.Start(); + try + { + var response = _resolverContractGraphQLApiResolverRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the resolver in the GraphQL API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Update + /// + /// + /// + /// 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. + /// GraphQL API Resolver Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, ResolverContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractResource.Update"); + scope.Start(); + try + { + var response = await _resolverContractGraphQLApiResolverRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ResolverContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the resolver in the GraphQL API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Update + /// + /// + /// + /// 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. + /// GraphQL API Resolver Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, ResolverContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractResource.Update"); + scope.Start(); + try + { + var response = _resolverContractGraphQLApiResolverRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken); + return Response.FromValue(new ResolverContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the GraphQL API resolver specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _resolverContractGraphQLApiResolverRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the GraphQL API resolver specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _resolverContractGraphQLApiResolverClientDiagnostics.CreateScope("ResolverContractResource.GetEntityTag"); + scope.Start(); + try + { + var response = _resolverContractGraphQLApiResolverRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiDiagnosticRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiDiagnosticRestOperations.cs index db864985bfcc..82dabdd794be 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiDiagnosticRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiDiagnosticRestOperations.cs @@ -33,7 +33,7 @@ public ApiDiagnosticRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all diagnostics of an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListByServiceAsync(string subs } /// Lists all diagnostics of an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the Diagnostic for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -201,8 +201,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the Diagnostic for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -261,8 +261,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the Diagnostic for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -296,8 +296,8 @@ public async Task> GetAsync(string subscription } /// Gets the details of the Diagnostic for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -363,8 +363,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new Diagnostic for an API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -400,8 +400,8 @@ public async Task> CreateOrUpdateAsync(string s } /// Creates a new Diagnostic for an API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -466,8 +466,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the details of the Diagnostic for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -502,8 +502,8 @@ public async Task> UpdateAsync(string subscript } /// Updates the details of the Diagnostic for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -563,8 +563,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified Diagnostic from an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -593,8 +593,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified Diagnostic from an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Diagnostic identifier. Must be unique in the current API Management service instance. @@ -638,8 +638,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists all diagnostics of an API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -674,8 +674,8 @@ public async Task> ListByServiceNextPageAsync(str /// Lists all diagnostics of an API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueAttachmentRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueAttachmentRestOperations.cs index 64f94382dd4e..8895f777eda8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueAttachmentRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueAttachmentRestOperations.cs @@ -33,7 +33,7 @@ public ApiIssueAttachmentRestOperations(HttpPipeline pipeline, string applicatio { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -75,8 +75,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all attachments for the Issue associated with the specified API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -111,8 +111,8 @@ public async Task> ListByServiceAsync(string } /// Lists all attachments for the Issue associated with the specified API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -173,8 +173,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the issue Attachment for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -211,8 +211,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the issue Attachment for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -275,8 +275,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the issue Attachment for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -312,8 +312,8 @@ public async Task> GetAsync(string subscription } /// Gets the details of the issue Attachment for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -383,8 +383,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new Attachment for the Issue in an API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -422,8 +422,8 @@ public async Task> CreateOrUpdateAsync(string s } /// Creates a new Attachment for the Issue in an API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -488,8 +488,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified comment from an Issue. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -520,8 +520,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified comment from an Issue. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -567,8 +567,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists all attachments for the Issue associated with the specified API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -605,8 +605,8 @@ public async Task> ListByServiceNextPageAsyn /// Lists all attachments for the Issue associated with the specified API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueCommentRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueCommentRestOperations.cs index f03fe5ed7a03..5d37b0445f86 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueCommentRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueCommentRestOperations.cs @@ -33,7 +33,7 @@ public ApiIssueCommentRestOperations(HttpPipeline pipeline, string applicationId { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -75,8 +75,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all comments for the Issue associated with the specified API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -111,8 +111,8 @@ public async Task> ListByServiceAsync(string su } /// Lists all comments for the Issue associated with the specified API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -173,8 +173,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the issue Comment for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -211,8 +211,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the issue Comment for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -275,8 +275,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the issue Comment for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -312,8 +312,8 @@ public async Task> GetAsync(string subscriptionId, } /// Gets the details of the issue Comment for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -383,8 +383,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new Comment for the Issue in an API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -422,8 +422,8 @@ public async Task> CreateOrUpdateAsync(string subs } /// Creates a new Comment for the Issue in an API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -488,8 +488,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified comment from an Issue. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -520,8 +520,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified comment from an Issue. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -567,8 +567,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists all comments for the Issue associated with the specified API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -605,8 +605,8 @@ public async Task> ListByServiceNextPageAsync(s /// Lists all comments for the Issue associated with the specified API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueRestOperations.cs index f6ead96eb010..0bd83169272e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiIssueRestOperations.cs @@ -33,7 +33,7 @@ public ApiIssueRestOperations(HttpPipeline pipeline, string applicationId, Uri e { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -77,8 +77,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all issues associated with the specified API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>. @@ -112,8 +112,8 @@ public async Task> ListByServiceAsync(string subscript } /// Lists all issues associated with the specified API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>. @@ -171,8 +171,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the Issue for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -207,8 +207,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the Issue for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -271,8 +271,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the Issue for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -307,8 +307,8 @@ public async Task> GetAsync(string subscriptionId, s } /// Gets the details of the Issue for an API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -375,8 +375,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new Issue for an API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -412,8 +412,8 @@ public async Task> CreateOrUpdateAsync(string subscr } /// Creates a new Issue for an API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -478,8 +478,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates an existing issue for an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -514,8 +514,8 @@ public async Task> UpdateAsync(string subscriptionId } /// Updates an existing issue for an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -575,8 +575,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified Issue from an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -605,8 +605,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified Issue from an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Issue identifier. Must be unique in the current API Management service instance. @@ -650,8 +650,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists all issues associated with the specified API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>. @@ -687,8 +687,8 @@ public async Task> ListByServiceNextPageAsync(string n /// Lists all issues associated with the specified API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementRestOperations.cs index 2a96fc8ab6a7..f108f98c9c42 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementRestOperations.cs @@ -32,7 +32,7 @@ public ApiManagementRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -62,8 +62,8 @@ internal HttpMessage CreatePerformConnectivityCheckAsyncRequest(string subscript } /// Performs a connectivity check between the API Management service and a given destination, and returns metrics for the connection, as well as errors encountered while trying to establish it. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Connectivity Check request parameters. /// The cancellation token to use. @@ -89,8 +89,8 @@ public async Task PerformConnectivityCheckAsyncAsync(string subscripti } /// Performs a connectivity check between the API Management service and a given destination, and returns metrics for the connection, as well as errors encountered while trying to establish it. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Connectivity Check request parameters. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceRestOperations.cs index c54b5fe7924d..0e12146056ab 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceRestOperations.cs @@ -33,7 +33,7 @@ public ApiManagementServiceRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -63,8 +63,8 @@ internal HttpMessage CreateRestoreRequest(string subscriptionId, string resource } /// 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. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the Restore API Management service from backup operation. /// The cancellation token to use. @@ -90,8 +90,8 @@ public async Task RestoreAsync(string subscriptionId, string resourceG } /// 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. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the Restore API Management service from backup operation. /// The cancellation token to use. @@ -142,8 +142,8 @@ internal HttpMessage CreateBackupRequest(string subscriptionId, string resourceG } /// Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the ApiManagementService_Backup operation. /// The cancellation token to use. @@ -169,8 +169,8 @@ public async Task BackupAsync(string subscriptionId, string resourceGr } /// Creates a backup of the API Management service to the given Azure Storage Account. This is long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the ApiManagementService_Backup operation. /// The cancellation token to use. @@ -220,8 +220,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates an API Management service. This is long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the CreateOrUpdate API Management service operation. /// The cancellation token to use. @@ -240,7 +240,6 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re { case 200: case 201: - case 202: return message.Response; default: throw new RequestFailedException(message.Response); @@ -248,8 +247,8 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates or updates an API Management service. This is long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the CreateOrUpdate API Management service operation. /// The cancellation token to use. @@ -268,7 +267,6 @@ public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, { case 200: case 201: - case 202: return message.Response; default: throw new RequestFailedException(message.Response); @@ -300,8 +298,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates an existing API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the CreateOrUpdate API Management service operation. /// The cancellation token to use. @@ -327,8 +325,8 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Updates an existing API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the CreateOrUpdate API Management service operation. /// The cancellation token to use. @@ -374,8 +372,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets an API Management service resource description. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -405,8 +403,8 @@ public async Task> GetAsync(string subscripti } /// Gets an API Management service resource description. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -456,8 +454,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes an existing API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -482,8 +480,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes an existing API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -507,6 +505,77 @@ public Response Delete(string subscriptionId, string resourceGroupName, string s } } + internal HttpMessage CreateMigrateToStv2Request(string subscriptionId, string resourceGroupName, string serviceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/migrateToStv2", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// 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. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task MigrateToStv2Async(string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateMigrateToStv2Request(subscriptionId, resourceGroupName, serviceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// 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. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response MigrateToStv2(string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateMigrateToStv2Request(subscriptionId, resourceGroupName, serviceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) { var message = _pipeline.CreateMessage(); @@ -527,8 +596,8 @@ internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, str } /// List all API Management services within a resource group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// or is null. /// or is an empty string, and was expected to be non-empty. @@ -554,8 +623,8 @@ public async Task> ListByResourceGroupA } /// List all API Management services within a resource group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// or is null. /// or is an empty string, and was expected to be non-empty. @@ -598,7 +667,7 @@ internal HttpMessage CreateListRequest(string subscriptionId) } /// Lists all API Management services within an Azure subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -623,7 +692,7 @@ public async Task> ListAsync(string sub } /// Lists all API Management services within an Azure subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -669,8 +738,8 @@ internal HttpMessage CreateGetSsoTokenRequest(string subscriptionId, string reso } /// Gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -698,8 +767,8 @@ public async Task> GetSsoTokenAs } /// Gets the Single-Sign-On token for the API Management Service which is valid for 5 Minutes. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -748,7 +817,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, A } /// Checks availability and correctness of a name for an API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// Parameters supplied to the CheckNameAvailability operation. /// The cancellation token to use. /// or is null. @@ -775,7 +844,7 @@ public async Task> CheckNam } /// Checks availability and correctness of a name for an API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// Parameters supplied to the CheckNameAvailability operation. /// The cancellation token to use. /// or is null. @@ -819,7 +888,7 @@ internal HttpMessage CreateGetDomainOwnershipIdentifierRequest(string subscripti } /// Get the custom domain ownership identifier for an API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -844,7 +913,7 @@ public async Task Get the custom domain ownership identifier for an API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -897,8 +966,8 @@ internal HttpMessage CreateApplyNetworkConfigurationUpdatesRequest(string subscr } /// Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated DNS changes. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the Apply Network Configuration operation. If the parameters are empty, all the regions in which the Api Management service is deployed will be updated sequentially without incurring downtime in the region. /// The cancellation token to use. @@ -923,8 +992,8 @@ public async Task ApplyNetworkConfigurationUpdatesAsync(string subscri } /// Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated DNS changes. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Parameters supplied to the Apply Network Configuration operation. If the parameters are empty, all the regions in which the Api Management service is deployed will be updated sequentially without incurring downtime in the region. /// The cancellation token to use. @@ -964,8 +1033,8 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s /// List all API Management services within a resource group. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// , or is null. /// or is an empty string, and was expected to be non-empty. @@ -993,8 +1062,8 @@ public async Task> ListByResourceGroupN /// List all API Management services within a resource group. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// , or is null. /// or is an empty string, and was expected to be non-empty. @@ -1036,7 +1105,7 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists all API Management services within an Azure subscription. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -1063,7 +1132,7 @@ public async Task> ListNextPageAsync(st /// Lists all API Management services within an Azure subscription. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceSkusRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceSkusRestOperations.cs index d2814c6dcfeb..45c695c5c1ef 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceSkusRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementServiceSkusRestOperations.cs @@ -33,7 +33,7 @@ public ApiManagementServiceSkusRestOperations(HttpPipeline pipeline, string appl { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListAvailableServiceSkusRequest(string subscriptionId } /// Gets all available SKU for a given API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> ListAvailableServiceSkusAsync(st } /// Gets all available SKU for a given API Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -132,8 +132,8 @@ internal HttpMessage CreateListAvailableServiceSkusNextPageRequest(string nextLi /// Gets all available SKU for a given API Management service. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , , or is null. @@ -163,8 +163,8 @@ public async Task> ListAvailableServiceSkusNextPage /// Gets all available SKU for a given API Management service. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , , or is null. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementSkusRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementSkusRestOperations.cs index 3873ec1e789e..08061f8df483 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementSkusRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiManagementSkusRestOperations.cs @@ -33,7 +33,7 @@ public ApiManagementSkusRestOperations(HttpPipeline pipeline, string application { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -55,7 +55,7 @@ internal HttpMessage CreateListRequest(string subscriptionId) } /// Gets the list of Microsoft.ApiManagement SKUs available for your Subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -80,7 +80,7 @@ public async Task> ListAsync(string subscripti } /// Gets the list of Microsoft.ApiManagement SKUs available for your Subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -120,7 +120,7 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Gets the list of Microsoft.ApiManagement SKUs available for your Subscription. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -147,7 +147,7 @@ public async Task> ListNextPageAsync(string ne /// Gets the list of Microsoft.ApiManagement SKUs available for your Subscription. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationPolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationPolicyRestOperations.cs index b536472bf818..7224e64d1f22 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationPolicyRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationPolicyRestOperations.cs @@ -33,7 +33,7 @@ public ApiOperationPolicyRestOperations(HttpPipeline pipeline, string applicatio { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -63,8 +63,8 @@ internal HttpMessage CreateListByOperationRequest(string subscriptionId, string } /// Get the list of policy configuration at the API Operation level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -96,8 +96,8 @@ public async Task> ListByOperationAsync(string subscr } /// Get the list of policy configuration at the API Operation level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -155,8 +155,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the API operation policy specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -192,8 +192,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the API operation policy specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -259,8 +259,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get the policy configuration at the API Operation level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -296,8 +296,8 @@ public async Task> GetAsync(string subscriptionId, } /// Get the policy configuration at the API Operation level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -367,8 +367,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates policy configuration for the API Operation level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -405,8 +405,8 @@ public async Task> CreateOrUpdateAsync(string subsc } /// Creates or updates policy configuration for the API Operation level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -470,8 +470,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the policy configuration at the Api Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -501,8 +501,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the policy configuration at the Api Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationRestOperations.cs index c4d7dea2c4ec..b7d6dd23c01b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiOperationRestOperations.cs @@ -33,7 +33,7 @@ public ApiOperationRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -77,8 +77,8 @@ internal HttpMessage CreateListByApiRequest(string subscriptionId, string resour } /// Lists a collection of the operations for the specified API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -112,8 +112,8 @@ public async Task> ListByApiAsync(string subscript } /// Lists a collection of the operations for the specified API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -171,8 +171,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the API operation specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -207,8 +207,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the API operation specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -267,8 +267,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the API Operation specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -302,8 +302,8 @@ public async Task> GetAsync(string subscriptionId, st } /// Gets the details of the API Operation specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -369,8 +369,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new operation in the API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -406,8 +406,8 @@ public async Task> CreateOrUpdateAsync(string subscri } /// Creates a new operation in the API or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -442,7 +442,7 @@ public Response CreateOrUpdate(string subscriptionId, string r } } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string operationId, ETag ifMatch, ApiOperationPatch patch) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string operationId, ETag ifMatch, OperationUpdateContract operationUpdateContract) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -465,33 +465,33 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); + content.JsonWriter.WriteObjectValue(operationUpdateContract); request.Content = content; _userAgent.Apply(message); return message; } /// Updates the details of the operation in the API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. /// 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. - /// API Operation Update parameters. + /// API Operation Update parameters. /// The cancellation token to use. - /// , , , , or is null. + /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string operationId, ETag ifMatch, ApiOperationPatch patch, CancellationToken cancellationToken = default) + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string operationId, ETag ifMatch, OperationUpdateContract operationUpdateContract, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(operationUpdateContract, nameof(operationUpdateContract)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, operationId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, operationId, ifMatch, operationUpdateContract); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -508,26 +508,26 @@ public async Task> UpdateAsync(string subscriptionId, } /// Updates the details of the operation in the API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. /// 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. - /// API Operation Update parameters. + /// API Operation Update parameters. /// The cancellation token to use. - /// , , , , or is null. + /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string operationId, ETag ifMatch, ApiOperationPatch patch, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string operationId, ETag ifMatch, OperationUpdateContract operationUpdateContract, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(operationUpdateContract, nameof(operationUpdateContract)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, operationId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, operationId, ifMatch, operationUpdateContract); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -569,8 +569,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified operation in the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -599,8 +599,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified operation in the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -644,8 +644,8 @@ internal HttpMessage CreateListByApiNextPageRequest(string nextLink, string subs /// Lists a collection of the operations for the specified API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -681,8 +681,8 @@ public async Task> ListByApiNextPageAsync(string n /// Lists a collection of the operations for the specified API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiPolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiPolicyRestOperations.cs index 586fcd8f031d..43f7690769c4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiPolicyRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiPolicyRestOperations.cs @@ -33,7 +33,7 @@ public ApiPolicyRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -61,8 +61,8 @@ internal HttpMessage CreateListByApiRequest(string subscriptionId, string resour } /// Get the policy configuration at the API level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// The cancellation token to use. @@ -92,8 +92,8 @@ public async Task> ListByApiAsync(string subscription } /// Get the policy configuration at the API level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// The cancellation token to use. @@ -147,8 +147,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the API policy specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// The identifier of the Policy. @@ -182,8 +182,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the API policy specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// The identifier of the Policy. @@ -245,8 +245,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get the policy configuration at the API level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// The identifier of the Policy. @@ -280,8 +280,8 @@ public async Task> GetAsync(string subscriptionId, } /// Get the policy configuration at the API level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// The identifier of the Policy. @@ -347,8 +347,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates policy configuration for the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// The identifier of the Policy. @@ -383,8 +383,8 @@ public async Task> CreateOrUpdateAsync(string subsc } /// Creates or updates policy configuration for the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// The identifier of the Policy. @@ -444,8 +444,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the policy configuration at the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// The identifier of the Policy. @@ -473,8 +473,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the policy configuration at the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// The identifier of the Policy. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiProductRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiProductRestOperations.cs index 9d86647df7d0..63b2986d49f5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiProductRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiProductRestOperations.cs @@ -33,7 +33,7 @@ public ApiProductRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByApisRequest(string subscriptionId, string resou } /// Lists all Products, which the API is part of. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListByApisAsync(string subscripti } /// Lists all Products, which the API is part of. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -156,8 +156,8 @@ internal HttpMessage CreateListByApisNextPageRequest(string nextLink, string sub /// Lists all Products, which the API is part of. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -192,8 +192,8 @@ public async Task> ListByApisNextPageAsync(string ne /// Lists all Products, which the API is part of. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiReleaseRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiReleaseRestOperations.cs index 744d7fe91a3b..3ce2522300bc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiReleaseRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiReleaseRestOperations.cs @@ -33,7 +33,7 @@ public ApiReleaseRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// 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. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListByServiceAsync(string subs } /// 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. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Returns the etag of an API release. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -201,8 +201,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Returns the etag of an API release. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -261,8 +261,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Returns the details of an API release. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -296,8 +296,8 @@ public async Task> GetAsync(string subscriptionId, stri } /// Returns the details of an API release. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -363,8 +363,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new Release for the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -400,8 +400,8 @@ public async Task> CreateOrUpdateAsync(string subscript } /// Creates a new Release for the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -466,8 +466,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the details of the release of the API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -502,8 +502,8 @@ public async Task> UpdateAsync(string subscriptionId, s } /// Updates the details of the release of the API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -563,8 +563,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified release in the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -593,8 +593,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified release in the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// Release identifier within an API. Must be unique in the current API Management service instance. @@ -638,8 +638,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// 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. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -674,8 +674,8 @@ public async Task> ListByServiceNextPageAsync(str /// 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. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRestOperations.cs index 3acb6eb34be0..544b2c211bd9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRestOperations.cs @@ -33,7 +33,7 @@ public ApiRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoi { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -79,8 +79,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all APIs of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. /// Number of records to return. @@ -113,8 +113,8 @@ public async Task> ListByServiceAsync(string subscriptio } /// Lists all APIs of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. /// Number of records to return. @@ -169,8 +169,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// The cancellation token to use. @@ -203,8 +203,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// The cancellation token to use. @@ -259,8 +259,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// The cancellation token to use. @@ -292,8 +292,8 @@ public async Task> GetAsync(string subscriptionId, string reso } /// Gets the details of the API specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// The cancellation token to use. @@ -324,7 +324,7 @@ public Response Get(string subscriptionId, string resourceGroupName, st } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ApiCreateOrUpdateContent content, ETag? ifMatch) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -347,32 +347,32 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(apiCreateOrUpdateParameter); + request.Content = content; _userAgent.Apply(message); return message; } /// Creates new or updates existing specified API of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. - /// Create or update parameters. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ApiCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(apiCreateOrUpdateParameter, nameof(apiCreateOrUpdateParameter)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, content, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, apiCreateOrUpdateParameter, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -386,24 +386,24 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates new or updates existing specified API of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. - /// Create or update parameters. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ApiCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(apiCreateOrUpdateParameter, nameof(apiCreateOrUpdateParameter)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, content, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, apiCreateOrUpdateParameter, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -416,7 +416,7 @@ public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, } } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, ApiPatch patch) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, ApiUpdateContract apiUpdateContract) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -437,31 +437,31 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); + content.JsonWriter.WriteObjectValue(apiUpdateContract); request.Content = content; _userAgent.Apply(message); return message; } /// Updates the specified API of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// 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. - /// API Update Contract parameters. + /// API Update Contract parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, ApiPatch patch, CancellationToken cancellationToken = default) + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, ApiUpdateContract apiUpdateContract, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(apiUpdateContract, nameof(apiUpdateContract)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, ifMatch, apiUpdateContract); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -478,24 +478,24 @@ public async Task> UpdateAsync(string subscriptionId, string r } /// Updates the specified API of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// 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. - /// API Update Contract parameters. + /// API Update Contract parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, ApiPatch patch, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, ApiUpdateContract apiUpdateContract, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(apiUpdateContract, nameof(apiUpdateContract)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, ifMatch, apiUpdateContract); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -539,8 +539,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified API of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// 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. @@ -568,8 +568,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified API of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// 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. @@ -634,8 +634,8 @@ internal HttpMessage CreateListByTagsRequest(string subscriptionId, string resou } /// Lists a collection of apis associated with tags. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq | |</br>. /// Number of records to return. @@ -667,8 +667,8 @@ public async Task> ListByTagsAsync(string subscr } /// Lists a collection of apis associated with tags. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq | |</br>. /// Number of records to return. @@ -715,8 +715,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists all APIs of the API Management service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. /// Number of records to return. @@ -751,8 +751,8 @@ public async Task> ListByServiceNextPageAsync(string nex /// Lists all APIs of the API Management service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. /// Number of records to return. @@ -801,8 +801,8 @@ internal HttpMessage CreateListByTagsNextPageRequest(string nextLink, string sub /// Lists a collection of apis associated with tags. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq | |</br>. /// Number of records to return. @@ -836,8 +836,8 @@ public async Task> ListByTagsNextPageAsync(strin /// Lists a collection of apis associated with tags. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq | |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRevisionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRevisionRestOperations.cs index f7273137f849..6e5d64f07f26 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRevisionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiRevisionRestOperations.cs @@ -33,7 +33,7 @@ public ApiRevisionRestOperations(HttpPipeline pipeline, string applicationId, Ur { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all revisions of an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListByServiceAsync(string sub } /// Lists all revisions of an API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -156,8 +156,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists all revisions of an API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -192,8 +192,8 @@ public async Task> ListByServiceNextPageAsync(st /// Lists all revisions of an API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// API identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiSchemaRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiSchemaRestOperations.cs index 6146360a2007..fc98bf363b44 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiSchemaRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiSchemaRestOperations.cs @@ -33,7 +33,7 @@ public ApiSchemaRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByApiRequest(string subscriptionId, string resour } /// Get the schema configuration at the API level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListByApiAsync(string subscription } /// Get the schema configuration at the API level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the schema specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Schema id identifier. Must be unique in the current API Management service instance. @@ -201,8 +201,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the schema specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Schema id identifier. Must be unique in the current API Management service instance. @@ -261,8 +261,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get the schema configuration at the API level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Schema id identifier. Must be unique in the current API Management service instance. @@ -296,8 +296,8 @@ public async Task> GetAsync(string subscriptionId, strin } /// Get the schema configuration at the API level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Schema id identifier. Must be unique in the current API Management service instance. @@ -363,8 +363,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates schema configuration for the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Schema id identifier. Must be unique in the current API Management service instance. @@ -396,8 +396,8 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates or updates schema configuration for the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Schema id identifier. Must be unique in the current API Management service instance. @@ -458,8 +458,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the schema configuration at the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Schema id identifier. Must be unique in the current API Management service instance. @@ -489,8 +489,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the schema configuration at the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Schema id identifier. Must be unique in the current API Management service instance. @@ -535,8 +535,8 @@ internal HttpMessage CreateListByApiNextPageRequest(string nextLink, string subs /// Get the schema configuration at the API level. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -571,8 +571,8 @@ public async Task> ListByApiNextPageAsync(string next /// Get the schema configuration at the API level. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiTagDescriptionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiTagDescriptionRestOperations.cs index 204b74a12868..d8256f0531e5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiTagDescriptionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiTagDescriptionRestOperations.cs @@ -33,7 +33,7 @@ public ApiTagDescriptionRestOperations(HttpPipeline pipeline, string application { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// 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. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListByServiceAsync(string } /// 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. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. @@ -201,8 +201,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. @@ -261,8 +261,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get Tag description in scope of API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. @@ -296,8 +296,8 @@ public async Task> GetAsync(string subscriptionI } /// Get Tag description in scope of API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. @@ -363,8 +363,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Create/Update tag description in scope of the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. @@ -400,8 +400,8 @@ public async Task> CreateOrUpdateAsync(string su } /// Create/Update tag description in scope of the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. @@ -462,8 +462,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Delete tag description for the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. @@ -492,8 +492,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Delete tag description for the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. @@ -537,8 +537,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// 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. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -573,8 +573,8 @@ public async Task> ListByServiceNextPageAsync /// 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. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiVersionSetRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiVersionSetRestOperations.cs index e78081ceb08e..68e2a2fb2ae9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiVersionSetRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiVersionSetRestOperations.cs @@ -33,7 +33,7 @@ public ApiVersionSetRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of API Version Sets in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(string s } /// Lists a collection of API Version Sets in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the Api Version Set specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -191,8 +191,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the Api Version Set specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -247,8 +247,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the Api Version Set specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -280,8 +280,8 @@ public async Task> GetAsync(string subscriptionId, s } /// Gets the details of the Api Version Set specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -343,8 +343,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or Updates a Api Version Set. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// Create or update parameters. @@ -378,8 +378,8 @@ public async Task> CreateOrUpdateAsync(string subscr } /// Creates or Updates a Api Version Set. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// Create or update parameters. @@ -412,7 +412,7 @@ public Response CreateOrUpdate(string subscriptionId, string } } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string versionSetId, ETag ifMatch, ApiVersionSetPatch patch) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string versionSetId, ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -433,31 +433,31 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); + content.JsonWriter.WriteObjectValue(apiVersionSetUpdateParameters); request.Content = content; _userAgent.Apply(message); return message; } /// Updates the details of the Api VersionSet specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// 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. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string versionSetId, ETag ifMatch, ApiVersionSetPatch patch, CancellationToken cancellationToken = default) + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string versionSetId, ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(apiVersionSetUpdateParameters, nameof(apiVersionSetUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, versionSetId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, versionSetId, ifMatch, apiVersionSetUpdateParameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -474,24 +474,24 @@ public async Task> UpdateAsync(string subscriptionId } /// Updates the details of the Api VersionSet specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// 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. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string versionSetId, ETag ifMatch, ApiVersionSetPatch patch, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string versionSetId, ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(apiVersionSetUpdateParameters, nameof(apiVersionSetUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, versionSetId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, versionSetId, ifMatch, apiVersionSetUpdateParameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -531,8 +531,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific Api Version Set. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// 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. @@ -559,8 +559,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific Api Version Set. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Api Version Set identifier. Must be unique in the current API Management service instance. /// 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. @@ -602,8 +602,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of API Version Sets in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. /// Number of records to return. @@ -636,8 +636,8 @@ public async Task> ListByServiceNextPageAsync( /// Lists a collection of API Version Sets in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiWikiRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiWikiRestOperations.cs new file mode 100644 index 000000000000..bae1d978de00 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ApiWikiRestOperations.cs @@ -0,0 +1,497 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class ApiWikiRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ApiWikiRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ApiWikiRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the Wiki for an API specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, apiId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the Wiki for an API specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, apiId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the Wiki for an API specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, apiId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WikiContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WikiContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the Wiki for an API specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, apiId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WikiContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WikiContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, WikiContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates a new Wiki for an API or updates an existing one. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, WikiContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + WikiContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a new Wiki for an API or updates an existing one. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string apiId, WikiContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + WikiContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, WikiUpdateContract wikiUpdateContract) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(wikiUpdateContract); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the Wiki for an API specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// 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. + /// Wiki Update parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, WikiUpdateContract wikiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(wikiUpdateContract, nameof(wikiUpdateContract)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, ifMatch, wikiUpdateContract); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WikiContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the Wiki for an API specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// 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. + /// Wiki Update parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, WikiUpdateContract wikiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(wikiUpdateContract, nameof(wikiUpdateContract)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, ifMatch, wikiUpdateContract); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WikiContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified Wiki from an API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, apiId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified Wiki from an API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// API identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string apiId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, apiId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationAccessPolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationAccessPolicyRestOperations.cs new file mode 100644 index 000000000000..07f358587749 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationAccessPolicyRestOperations.cs @@ -0,0 +1,542 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class AuthorizationAccessPolicyRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AuthorizationAccessPolicyRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public AuthorizationAccessPolicyRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByAuthorizationRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationId, true); + uri.AppendPath("/accessPolicies", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of authorization access policy defined within a authorization. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByAuthorizationAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var message = CreateListByAuthorizationRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationAccessPolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationAccessPolicyListResult.DeserializeAuthorizationAccessPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of authorization access policy defined within a authorization. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByAuthorization(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var message = CreateListByAuthorizationRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationAccessPolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationAccessPolicyListResult.DeserializeAuthorizationAccessPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationId, true); + uri.AppendPath("/accessPolicies/", false); + uri.AppendPath(authorizationAccessPolicyId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the authorization access policy specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Identifier of the authorization access policy. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationAccessPolicyId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationAccessPolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationAccessPolicyContractData.DeserializeAuthorizationAccessPolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AuthorizationAccessPolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the authorization access policy specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Identifier of the authorization access policy. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationAccessPolicyId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationAccessPolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationAccessPolicyContractData.DeserializeAuthorizationAccessPolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AuthorizationAccessPolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId, AuthorizationAccessPolicyContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationId, true); + uri.AppendPath("/accessPolicies/", false); + uri.AppendPath(authorizationAccessPolicyId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates Authorization Access Policy. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Identifier of the authorization access policy. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId, AuthorizationAccessPolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationAccessPolicyId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + AuthorizationAccessPolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationAccessPolicyContractData.DeserializeAuthorizationAccessPolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates Authorization Access Policy. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Identifier of the authorization access policy. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId, AuthorizationAccessPolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationAccessPolicyId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + AuthorizationAccessPolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationAccessPolicyContractData.DeserializeAuthorizationAccessPolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationId, true); + uri.AppendPath("/accessPolicies/", false); + uri.AppendPath(authorizationAccessPolicyId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes specific access policy from the Authorization. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Identifier of the authorization access policy. + /// 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. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationAccessPolicyId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes specific access policy from the Authorization. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Identifier of the authorization access policy. + /// 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. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string authorizationAccessPolicyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNullOrEmpty(authorizationAccessPolicyId, nameof(authorizationAccessPolicyId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationAccessPolicyId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByAuthorizationNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of authorization access policy defined within a authorization. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByAuthorizationNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var message = CreateListByAuthorizationNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationAccessPolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationAccessPolicyListResult.DeserializeAuthorizationAccessPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of authorization access policy defined within a authorization. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByAuthorizationNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var message = CreateListByAuthorizationNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationAccessPolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationAccessPolicyListResult.DeserializeAuthorizationAccessPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationLoginLinksRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationLoginLinksRestOperations.cs new file mode 100644 index 000000000000..43392593cc2f --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationLoginLinksRestOperations.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class AuthorizationLoginLinksRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AuthorizationLoginLinksRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public AuthorizationLoginLinksRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreatePostRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, AuthorizationLoginRequestContract authorizationLoginRequestContract) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationId, true); + uri.AppendPath("/getLoginLinks", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(authorizationLoginRequestContract); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Gets authorization login links. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Create parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> PostAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, AuthorizationLoginRequestContract authorizationLoginRequestContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNull(authorizationLoginRequestContract, nameof(authorizationLoginRequestContract)); + + using var message = CreatePostRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationLoginRequestContract); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationLoginResponseContract value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationLoginResponseContract.DeserializeAuthorizationLoginResponseContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets authorization login links. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Create parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Post(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, AuthorizationLoginRequestContract authorizationLoginRequestContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNull(authorizationLoginRequestContract, nameof(authorizationLoginRequestContract)); + + using var message = CreatePostRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationLoginRequestContract); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationLoginResponseContract value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationLoginResponseContract.DeserializeAuthorizationLoginResponseContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationProviderRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationProviderRestOperations.cs new file mode 100644 index 000000000000..99dc5f6c3665 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationProviderRestOperations.cs @@ -0,0 +1,486 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class AuthorizationProviderRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AuthorizationProviderRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public AuthorizationProviderRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of authorization providers defined within a service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationProviderListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationProviderListResult.DeserializeAuthorizationProviderListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of authorization providers defined within a service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationProviderListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationProviderListResult.DeserializeAuthorizationProviderListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the authorization provider specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationProviderContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationProviderContractData.DeserializeAuthorizationProviderContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AuthorizationProviderContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the authorization provider specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationProviderContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationProviderContractData.DeserializeAuthorizationProviderContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AuthorizationProviderContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, AuthorizationProviderContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates authorization provider. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, AuthorizationProviderContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + AuthorizationProviderContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationProviderContractData.DeserializeAuthorizationProviderContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates authorization provider. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, AuthorizationProviderContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + AuthorizationProviderContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationProviderContractData.DeserializeAuthorizationProviderContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes specific authorization provider from the API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// 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. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes specific authorization provider from the API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// 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. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of authorization providers defined within a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationProviderListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationProviderListResult.DeserializeAuthorizationProviderListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of authorization providers defined within a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationProviderListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationProviderListResult.DeserializeAuthorizationProviderListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationRestOperations.cs new file mode 100644 index 000000000000..35c6482079c3 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationRestOperations.cs @@ -0,0 +1,603 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class AuthorizationRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AuthorizationRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public AuthorizationRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByAuthorizationProviderRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of authorization providers defined within a authorization provider. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByAuthorizationProviderAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var message = CreateListByAuthorizationProviderRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationListResult.DeserializeAuthorizationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of authorization providers defined within a authorization provider. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByAuthorizationProvider(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var message = CreateListByAuthorizationProviderRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationListResult.DeserializeAuthorizationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the authorization specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationContractData.DeserializeAuthorizationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AuthorizationContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the authorization specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationContractData.DeserializeAuthorizationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AuthorizationContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, AuthorizationContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates authorization. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, AuthorizationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + AuthorizationContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationContractData.DeserializeAuthorizationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates authorization. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, AuthorizationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + AuthorizationContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationContractData.DeserializeAuthorizationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes specific Authorization from the Authorization provider. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes specific Authorization from the Authorization provider. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateConfirmConsentCodeRequest(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, AuthorizationConfirmConsentCodeRequestContract authorizationConfirmConsentCodeRequestContract) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/authorizationProviders/", false); + uri.AppendPath(authorizationProviderId, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationId, true); + uri.AppendPath("/confirmConsentCode", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(authorizationConfirmConsentCodeRequestContract); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Confirm valid consent code to suppress Authorizations anti-phishing page. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Create parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task ConfirmConsentCodeAsync(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, AuthorizationConfirmConsentCodeRequestContract authorizationConfirmConsentCodeRequestContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNull(authorizationConfirmConsentCodeRequestContract, nameof(authorizationConfirmConsentCodeRequestContract)); + + using var message = CreateConfirmConsentCodeRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationConfirmConsentCodeRequestContract); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Confirm valid consent code to suppress Authorizations anti-phishing page. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// Identifier of the authorization. + /// Create parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ConfirmConsentCode(string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string authorizationId, AuthorizationConfirmConsentCodeRequestContract authorizationConfirmConsentCodeRequestContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + Argument.AssertNotNullOrEmpty(authorizationId, nameof(authorizationId)); + Argument.AssertNotNull(authorizationConfirmConsentCodeRequestContract, nameof(authorizationConfirmConsentCodeRequestContract)); + + using var message = CreateConfirmConsentCodeRequest(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId, authorizationConfirmConsentCodeRequestContract); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByAuthorizationProviderNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of authorization providers defined within a authorization provider. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByAuthorizationProviderNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var message = CreateListByAuthorizationProviderNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, authorizationProviderId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AuthorizationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AuthorizationListResult.DeserializeAuthorizationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of authorization providers defined within a authorization provider. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Identifier of the authorization provider. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByAuthorizationProviderNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string authorizationProviderId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(authorizationProviderId, nameof(authorizationProviderId)); + + using var message = CreateListByAuthorizationProviderNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, authorizationProviderId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AuthorizationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AuthorizationListResult.DeserializeAuthorizationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationServerRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationServerRestOperations.cs index f4beb4291e8c..9d32b85130ca 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationServerRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/AuthorizationServerRestOperations.cs @@ -33,7 +33,7 @@ public AuthorizationServerRestOperations(HttpPipeline pipeline, string applicati { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of authorization servers defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(st } /// Lists a collection of authorization servers defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the authorizationServer specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// The cancellation token to use. @@ -191,8 +191,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the authorizationServer specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// The cancellation token to use. @@ -247,8 +247,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the authorization server specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// The cancellation token to use. @@ -280,8 +280,8 @@ public async Task> GetAsync(strin } /// Gets the details of the authorization server specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// The cancellation token to use. @@ -343,8 +343,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates new authorization server or updates an existing authorization server. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// Create or update parameters. @@ -378,8 +378,8 @@ public async Task> CreateOrUpdate } /// Creates new authorization server or updates an existing authorization server. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// Create or update parameters. @@ -440,8 +440,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the details of the authorization server specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// 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. @@ -474,8 +474,8 @@ public async Task> UpdateAsync(st } /// Updates the details of the authorization server specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// 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. @@ -531,8 +531,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific authorization server instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// 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. @@ -559,8 +559,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific authorization server instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// 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. @@ -610,8 +610,8 @@ internal HttpMessage CreateListSecretsRequest(string subscriptionId, string reso } /// Gets the client secret details of the authorization server. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// The cancellation token to use. @@ -641,8 +641,8 @@ public async Task> ListSecretsAsync } /// Gets the client secret details of the authorization server. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the authorization server. /// The cancellation token to use. @@ -687,8 +687,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of authorization servers defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -721,8 +721,8 @@ public async Task> ListByServiceNextPage /// Lists a collection of authorization servers defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/BackendRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/BackendRestOperations.cs index d237bf27a89d..c33bcda33d94 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/BackendRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/BackendRestOperations.cs @@ -33,7 +33,7 @@ public BackendRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of backends in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| url | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(string subscri } /// Lists a collection of backends in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| url | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the backend specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -191,8 +191,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the backend specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -247,8 +247,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the backend specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -280,8 +280,8 @@ public async Task> GetAsync(string subscripti } /// Gets the details of the backend specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -343,8 +343,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or Updates a backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// Create parameters. @@ -378,8 +378,8 @@ public async Task> CreateOrUpdateAsync(string } /// Creates or Updates a backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// Create parameters. @@ -440,8 +440,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates an existing backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// 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. @@ -474,8 +474,8 @@ public async Task> UpdateAsync(string subscri } /// Updates an existing backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// 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. @@ -531,8 +531,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// 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. @@ -559,8 +559,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// 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. @@ -616,9 +616,9 @@ internal HttpMessage CreateReconnectRequest(string subscriptionId, string resour return message; } - /// 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. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// 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. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// Reconnect request parameters. @@ -643,9 +643,9 @@ public async Task ReconnectAsync(string subscriptionId, string resourc } } - /// 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. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// 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. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// Reconnect request parameters. @@ -686,8 +686,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of backends in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| url | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -720,8 +720,8 @@ public async Task> ListByServiceNextPageAsync(string /// Lists a collection of backends in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| url | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CacheRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CacheRestOperations.cs index 4b9168355c5a..9b8ea894ff0d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CacheRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CacheRestOperations.cs @@ -33,7 +33,7 @@ public CacheRestOperations(HttpPipeline pipeline, string applicationId, Uri endp { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -67,8 +67,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of all external Caches in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Number of records to return. /// Number of records to skip. @@ -98,8 +98,8 @@ public async Task> ListByServiceAsync(string subscript } /// Lists a collection of all external Caches in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Number of records to return. /// Number of records to skip. @@ -151,8 +151,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the Cache specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// The cancellation token to use. @@ -185,8 +185,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the Cache specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// The cancellation token to use. @@ -241,8 +241,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the Cache specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// The cancellation token to use. @@ -274,8 +274,8 @@ public async Task> GetAsync(string subscription } /// Gets the details of the Cache specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// The cancellation token to use. @@ -337,8 +337,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates an External Cache to be used in Api Management instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// Create or Update parameters. @@ -372,8 +372,8 @@ public async Task> CreateOrUpdateAsync(string s } /// Creates or updates an External Cache to be used in Api Management instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// Create or Update parameters. @@ -434,8 +434,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the details of the cache specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// 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. @@ -468,8 +468,8 @@ public async Task> UpdateAsync(string subscript } /// Updates the details of the cache specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// 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. @@ -525,8 +525,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific Cache. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// 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. @@ -553,8 +553,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific Cache. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// 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. @@ -596,8 +596,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of all external Caches in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Number of records to return. /// Number of records to skip. @@ -629,8 +629,8 @@ public async Task> ListByServiceNextPageAsync(string n /// Lists a collection of all external Caches in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Number of records to return. /// Number of records to skip. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CertificateRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CertificateRestOperations.cs index 53723e58eb02..e156d57f0c21 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CertificateRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/CertificateRestOperations.cs @@ -33,7 +33,7 @@ public CertificateRestOperations(HttpPipeline pipeline, string applicationId, Ur { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -75,8 +75,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of all certificates in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| subject | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| thumbprint | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| expirationDate | filter | ge, le, eq, ne, gt, lt | |</br>. /// Number of records to return. @@ -108,8 +108,8 @@ public async Task> ListByServiceAsync(string sub } /// Lists a collection of all certificates in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| subject | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| thumbprint | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| expirationDate | filter | ge, le, eq, ne, gt, lt | |</br>. /// Number of records to return. @@ -163,8 +163,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the certificate specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -197,8 +197,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the certificate specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -253,8 +253,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the certificate specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -286,8 +286,8 @@ public async Task> GetAsync(string subscr } /// Gets the details of the certificate specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -349,8 +349,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates the certificate being used for authentication with the backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// Create or Update parameters. @@ -384,8 +384,8 @@ public async Task> CreateOrUpdateAsync(st } /// Creates or updates the certificate being used for authentication with the backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// Create or Update parameters. @@ -442,8 +442,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific certificate. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// 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. @@ -470,8 +470,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific certificate. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// 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. @@ -521,8 +521,8 @@ internal HttpMessage CreateRefreshSecretRequest(string subscriptionId, string re } /// From KeyVault, Refresh the certificate being used for authentication with the backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -552,8 +552,8 @@ public async Task> RefreshSecretAsync(str } /// From KeyVault, Refresh the certificate being used for authentication with the backend. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -598,8 +598,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of all certificates in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| subject | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| thumbprint | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| expirationDate | filter | ge, le, eq, ne, gt, lt | |</br>. /// Number of records to return. @@ -633,8 +633,8 @@ public async Task> ListByServiceNextPageAsync(st /// Lists a collection of all certificates in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| subject | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| thumbprint | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| expirationDate | filter | ge, le, eq, ne, gt, lt | |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ContentItemRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ContentItemRestOperations.cs index 392b96b5ff35..ded5f64543e7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ContentItemRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ContentItemRestOperations.cs @@ -33,7 +33,7 @@ public ContentItemRestOperations(HttpPipeline pipeline, string applicationId, Ur { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -61,8 +61,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists developer portal's content items specified by the provided content type. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// The cancellation token to use. @@ -92,8 +92,8 @@ public async Task> ListByServiceAsync(string sub } /// Lists developer portal's content items specified by the provided content type. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// The cancellation token to use. @@ -147,8 +147,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Returns the entity state (ETag) version of the developer portal's content item specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// Content item identifier. @@ -183,8 +183,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Returns the entity state (ETag) version of the developer portal's content item specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// Content item identifier. @@ -243,8 +243,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Returns the developer portal's content item specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// Content item identifier. @@ -276,8 +276,8 @@ public async Task> GetAsync(string subscripti } /// Returns the developer portal's content item specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// Content item identifier. @@ -308,7 +308,7 @@ public Response Get(string subscriptionId, string reso } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, ETag? ifMatch) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, ApiManagementContentItem apiManagementContentItem, ETag? ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -332,29 +332,35 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Headers.Add("If-Match", ifMatch.Value); } request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(apiManagementContentItem); + request.Content = content; _userAgent.Apply(message); return message; } /// Creates a new developer portal's content item specified by the provided content type. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// Content item identifier. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , , or is null. + /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, ApiManagementContentItem apiManagementContentItem, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(contentTypeId, nameof(contentTypeId)); Argument.AssertNotNullOrEmpty(contentItemId, nameof(contentItemId)); + Argument.AssertNotNull(apiManagementContentItem, nameof(apiManagementContentItem)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, contentTypeId, contentItemId, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, contentTypeId, contentItemId, apiManagementContentItem, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -372,24 +378,26 @@ public async Task> CreateOrUpdateAsync(string } /// Creates a new developer portal's content item specified by the provided content type. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// Content item identifier. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , , or is null. + /// , , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, ApiManagementContentItem apiManagementContentItem, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(contentTypeId, nameof(contentTypeId)); Argument.AssertNotNullOrEmpty(contentItemId, nameof(contentItemId)); + Argument.AssertNotNull(apiManagementContentItem, nameof(apiManagementContentItem)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, contentTypeId, contentItemId, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, contentTypeId, contentItemId, apiManagementContentItem, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -432,8 +440,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Removes the specified developer portal's content item. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// Content item identifier. @@ -462,8 +470,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Removes the specified developer portal's content item. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// Content item identifier. @@ -507,8 +515,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists developer portal's content items specified by the provided content type. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// The cancellation token to use. @@ -540,8 +548,8 @@ public async Task> ListByServiceNextPageAsync(st /// Lists developer portal's content items specified by the provided content type. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ContentTypeRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ContentTypeRestOperations.cs index 670bb962e5e9..bff2198c45ae 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ContentTypeRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ContentTypeRestOperations.cs @@ -33,7 +33,7 @@ public ContentTypeRestOperations(HttpPipeline pipeline, string applicationId, Ur { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists the developer portal's content types. Content types describe content items' properties, validation rules, and constraints. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> ListByServiceAsync(string sub } /// Lists the developer portal's content types. Content types describe content items' properties, validation rules, and constraints. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -139,8 +139,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the developer portal's content type. Content types describe content items' properties, validation rules, and constraints. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// The cancellation token to use. @@ -170,8 +170,8 @@ public async Task> GetAsync(string subscripti } /// Gets the details of the developer portal's content type. Content types describe content items' properties, validation rules, and constraints. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// The cancellation token to use. @@ -200,7 +200,7 @@ public Response Get(string subscriptionId, string reso } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, ETag? ifMatch) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, ApiManagementContentType apiManagementContentType, ETag? ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -222,27 +222,33 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r request.Headers.Add("If-Match", ifMatch.Value); } request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(apiManagementContentType); + request.Content = content; _userAgent.Apply(message); return message; } /// Creates or updates the developer portal's content type. Content types describe content items' properties, validation rules, and constraints. Custom content types' identifiers need to start with the `c-` prefix. Built-in content types can't be modified. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, ApiManagementContentType apiManagementContentType, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(contentTypeId, nameof(contentTypeId)); + Argument.AssertNotNull(apiManagementContentType, nameof(apiManagementContentType)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, contentTypeId, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, contentTypeId, apiManagementContentType, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -260,22 +266,24 @@ public async Task> CreateOrUpdateAsync(string } /// Creates or updates the developer portal's content type. Content types describe content items' properties, validation rules, and constraints. Custom content types' identifiers need to start with the `c-` prefix. Built-in content types can't be modified. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string contentTypeId, ApiManagementContentType apiManagementContentType, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(contentTypeId, nameof(contentTypeId)); + Argument.AssertNotNull(apiManagementContentType, nameof(apiManagementContentType)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, contentTypeId, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, contentTypeId, apiManagementContentType, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -316,8 +324,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Removes the specified developer portal's content type. Content types describe content items' properties, validation rules, and constraints. Built-in content types (with identifiers starting with the `c-` prefix) can't be removed. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// 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. @@ -344,8 +352,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Removes the specified developer portal's content type. Content types describe content items' properties, validation rules, and constraints. Built-in content types (with identifiers starting with the `c-` prefix) can't be removed. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Content type identifier. /// 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. @@ -387,8 +395,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists the developer portal's content types. Content types describe content items' properties, validation rules, and constraints. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , , or is null. @@ -418,8 +426,8 @@ public async Task> ListByServiceNextPageAsync(st /// Lists the developer portal's content types. Content types describe content items' properties, validation rules, and constraints. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , , or is null. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DelegationSettingsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DelegationSettingsRestOperations.cs index 3f057b998be4..1eacd0937542 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DelegationSettingsRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DelegationSettingsRestOperations.cs @@ -33,7 +33,7 @@ public DelegationSettingsRestOperations(HttpPipeline pipeline, string applicatio { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the DelegationSettings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -91,8 +91,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the DelegationSettings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -144,8 +144,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get Delegation Settings for the Portal. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -175,8 +175,8 @@ public async Task> GetAsync(s } /// Get Delegation Settings for the Portal. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -232,8 +232,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Update Delegation settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Update Delegation settings. @@ -259,8 +259,8 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Update Delegation settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Update Delegation settings. @@ -315,8 +315,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Create or Update Delegation settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. @@ -347,8 +347,8 @@ public async Task> CreateOrUp } /// Create or Update Delegation settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. @@ -400,8 +400,8 @@ internal HttpMessage CreateListSecretsRequest(string subscriptionId, string reso } /// Gets the secret validation key of the DelegationSettings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -429,8 +429,8 @@ public async Task> ListSecretsAsync } /// Gets the secret validation key of the DelegationSettings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DeletedServicesRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DeletedServicesRestOperations.cs index 7191bf897c40..2866e67c697e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DeletedServicesRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DeletedServicesRestOperations.cs @@ -33,7 +33,7 @@ public DeletedServicesRestOperations(HttpPipeline pipeline, string applicationId { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -55,7 +55,7 @@ internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) } /// Lists all soft-deleted services available for undelete for the given subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -80,7 +80,7 @@ public async Task> ListBySubscriptionAsync(s } /// Lists all soft-deleted services available for undelete for the given subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -125,7 +125,7 @@ internal HttpMessage CreateGetByNameRequest(string subscriptionId, AzureLocation } /// Get soft-deleted Api Management Service by name. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The location of the deleted API Management service. /// The name of the API Management service. /// The cancellation token to use. @@ -155,7 +155,7 @@ public async Task> GetByNameAsync(stri } /// Get soft-deleted Api Management Service by name. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The location of the deleted API Management service. /// The name of the API Management service. /// The cancellation token to use. @@ -205,7 +205,7 @@ internal HttpMessage CreatePurgeRequest(string subscriptionId, AzureLocation loc } /// Purges Api Management Service (deletes it with no option to undelete). - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The location of the deleted API Management service. /// The name of the API Management service. /// The cancellation token to use. @@ -230,7 +230,7 @@ public async Task PurgeAsync(string subscriptionId, AzureLocation loca } /// Purges Api Management Service (deletes it with no option to undelete). - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The location of the deleted API Management service. /// The name of the API Management service. /// The cancellation token to use. @@ -270,7 +270,7 @@ internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, st /// Lists all soft-deleted services available for undelete for the given subscription. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -297,7 +297,7 @@ public async Task> ListBySubscriptionNextPag /// Lists all soft-deleted services available for undelete for the given subscription. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DiagnosticRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DiagnosticRestOperations.cs index 89bd396dc6ee..04b4c9eb5201 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DiagnosticRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DiagnosticRestOperations.cs @@ -33,7 +33,7 @@ public DiagnosticRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all diagnostics of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(string subs } /// Lists all diagnostics of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the Diagnostic specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -191,8 +191,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the Diagnostic specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -247,8 +247,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the Diagnostic specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -280,8 +280,8 @@ public async Task> GetAsync(string subscription } /// Gets the details of the Diagnostic specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -343,8 +343,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new Diagnostic or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// Create parameters. @@ -378,8 +378,8 @@ public async Task> CreateOrUpdateAsync(string s } /// Creates a new Diagnostic or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// Create parameters. @@ -440,8 +440,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the details of the Diagnostic specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// 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. @@ -474,8 +474,8 @@ public async Task> UpdateAsync(string subscript } /// Updates the details of the Diagnostic specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// 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. @@ -531,8 +531,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified Diagnostic. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// 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. @@ -559,8 +559,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified Diagnostic. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Diagnostic identifier. Must be unique in the current API Management service instance. /// 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. @@ -602,8 +602,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists all diagnostics of the API Management service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -636,8 +636,8 @@ public async Task> ListByServiceNextPageAsync(str /// Lists all diagnostics of the API Management service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DocumentationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DocumentationRestOperations.cs new file mode 100644 index 000000000000..c067a30d6d77 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/DocumentationRestOperations.cs @@ -0,0 +1,671 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class DocumentationRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DocumentationRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public DocumentationRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/documentations", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all Documentations of the API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq | contains |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DocumentationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DocumentationListResult.DeserializeDocumentationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all Documentations of the API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq | contains |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DocumentationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DocumentationListResult.DeserializeDocumentationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string documentationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/documentations/", false); + uri.AppendPath(documentationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the Documentation by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, documentationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the Documentation by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, documentationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string documentationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/documentations/", false); + uri.AppendPath(documentationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the Documentation specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, documentationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DocumentationContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DocumentationContractData.DeserializeDocumentationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DocumentationContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the Documentation specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, documentationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DocumentationContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DocumentationContractData.DeserializeDocumentationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DocumentationContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, DocumentationContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/documentations/", false); + uri.AppendPath(documentationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates a new Documentation or updates an existing one. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, DocumentationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, documentationId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + DocumentationContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DocumentationContractData.DeserializeDocumentationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a new Documentation or updates an existing one. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, DocumentationContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, documentationId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + DocumentationContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DocumentationContractData.DeserializeDocumentationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, ETag ifMatch, DocumentationContractPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/documentations/", false); + uri.AppendPath(documentationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the Documentation for an API specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// 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. + /// Documentation Update parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, ETag ifMatch, DocumentationContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, documentationId, ifMatch, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DocumentationContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DocumentationContractData.DeserializeDocumentationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the Documentation for an API specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// 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. + /// Documentation Update parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, ETag ifMatch, DocumentationContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, documentationId, ifMatch, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DocumentationContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DocumentationContractData.DeserializeDocumentationContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/documentations/", false); + uri.AppendPath(documentationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified Documentation from an API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, documentationId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified Documentation from an API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Documentation identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string documentationId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(documentationId, nameof(documentationId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, documentationId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all Documentations of the API Management service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq | contains |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DocumentationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DocumentationListResult.DeserializeDocumentationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all Documentations of the API Management service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq | contains |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DocumentationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DocumentationListResult.DeserializeDocumentationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/EmailTemplateRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/EmailTemplateRestOperations.cs index 949227840259..aadd14ff2423 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/EmailTemplateRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/EmailTemplateRestOperations.cs @@ -33,7 +33,7 @@ public EmailTemplateRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Gets all email templates. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(string s } /// Gets all email templates. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the email template specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// The cancellation token to use. @@ -190,8 +190,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the email template specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// The cancellation token to use. @@ -245,8 +245,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the email template specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// The cancellation token to use. @@ -277,8 +277,8 @@ public async Task> GetAsync(string subs } /// Gets the details of the email template specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// The cancellation token to use. @@ -339,8 +339,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Updates an Email Template. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// Email Template update parameters. @@ -373,8 +373,8 @@ public async Task> CreateOrUpdateAsync( } /// Updates an Email Template. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// Email Template update parameters. @@ -434,8 +434,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates API Management email template. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// 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. @@ -467,8 +467,8 @@ public async Task> UpdateAsync(string s } /// Updates API Management email template. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// 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. @@ -523,8 +523,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Reset the Email Template to default template provided by the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// 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. @@ -550,8 +550,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Reset the Email Template to default template provided by the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Email Template Name Identifier. /// 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. @@ -592,8 +592,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Gets all email templates. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -626,8 +626,8 @@ public async Task> ListByServiceNextPageAsync( /// Gets all email templates. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayApiRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayApiRestOperations.cs index 76c419530102..dbb15c1c5c15 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayApiRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayApiRestOperations.cs @@ -33,7 +33,7 @@ public GatewayApiRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of the APIs associated with a gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListByServiceAsyn } /// Lists a collection of the APIs associated with a gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Checks that API entity specified by identifier is associated with the Gateway entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// API identifier. Must be unique in the current API Management service instance. @@ -201,8 +201,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Checks that API entity specified by identifier is associated with the Gateway entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// API identifier. Must be unique in the current API Management service instance. @@ -268,8 +268,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Adds an API to the specified Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// API identifier. Must be unique in the current API Management service instance. @@ -303,8 +303,8 @@ public async Task> CreateOrUpdateAsync(string subscript } /// Adds an API to the specified Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// API identifier. Must be unique in the current API Management service instance. @@ -362,8 +362,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified API from the specified Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// API identifier. Must be unique in the current API Management service instance. @@ -391,8 +391,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified API from the specified Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// API identifier. Must be unique in the current API Management service instance. @@ -435,8 +435,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of the APIs associated with a gateway. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -471,8 +471,8 @@ public async Task> ListByServiceNext /// Lists a collection of the APIs associated with a gateway. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayCertificateAuthorityRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayCertificateAuthorityRestOperations.cs index 6cb5d95623c4..ae409b4cea9a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayCertificateAuthorityRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayCertificateAuthorityRestOperations.cs @@ -33,7 +33,7 @@ public GatewayCertificateAuthorityRestOperations(HttpPipeline pipeline, string a { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists the collection of Certificate Authorities for the specified Gateway entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq, ne | |</br>. @@ -107,8 +107,8 @@ public async Task> ListByService } /// Lists the collection of Certificate Authorities for the specified Gateway entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq, ne | |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Checks if Certificate entity is assigned to Gateway entity as Certificate Authority. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. @@ -201,8 +201,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Checks if Certificate entity is assigned to Gateway entity as Certificate Authority. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. @@ -261,8 +261,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get assigned Gateway Certificate Authority details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. @@ -296,8 +296,8 @@ public async Task> GetAsy } /// Get assigned Gateway Certificate Authority details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. @@ -363,8 +363,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Assign Certificate entity to Gateway entity as Certificate Authority. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. @@ -400,8 +400,8 @@ public async Task> Create } /// Assign Certificate entity to Gateway entity as Certificate Authority. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. @@ -462,8 +462,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Remove relationship between Certificate Authority and Gateway entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. @@ -492,8 +492,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Remove relationship between Certificate Authority and Gateway entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Identifier of the certificate entity. Must be unique in the current API Management service instance. @@ -537,8 +537,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists the collection of Certificate Authorities for the specified Gateway entity. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq, ne | |</br>. @@ -573,8 +573,8 @@ public async Task> ListByService /// Lists the collection of Certificate Authorities for the specified Gateway entity. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | eq, ne | |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayHostnameConfigurationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayHostnameConfigurationRestOperations.cs index 3dd8d429ed9f..96da453ad0d1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayHostnameConfigurationRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayHostnameConfigurationRestOperations.cs @@ -33,7 +33,7 @@ public GatewayHostnameConfigurationRestOperations(HttpPipeline pipeline, string { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists the collection of hostname configurations for the specified gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| hostname | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListByServic } /// Lists the collection of hostname configurations for the specified gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| hostname | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Checks that hostname configuration entity specified by identifier exists for specified Gateway entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. @@ -201,8 +201,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Checks that hostname configuration entity specified by identifier exists for specified Gateway entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. @@ -261,8 +261,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get details of a hostname configuration. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. @@ -296,8 +296,8 @@ public async Task> GetAs } /// Get details of a hostname configuration. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. @@ -363,8 +363,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates of updates hostname configuration for a Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. @@ -400,8 +400,8 @@ public async Task> Creat } /// Creates of updates hostname configuration for a Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. @@ -462,8 +462,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified hostname configuration from the specified Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. @@ -492,8 +492,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified hostname configuration from the specified Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. @@ -537,8 +537,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists the collection of hostname configurations for the specified gateway. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| hostname | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -573,8 +573,8 @@ public async Task> ListByServic /// Lists the collection of hostname configurations for the specified gateway. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| hostname | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayRestOperations.cs index 26168982b769..53bf18af1fdd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GatewayRestOperations.cs @@ -33,7 +33,7 @@ public GatewayRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of gateways registered with service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| region | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(string subscri } /// Lists a collection of gateways registered with service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| region | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the Gateway specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The cancellation token to use. @@ -191,8 +191,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the Gateway specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The cancellation token to use. @@ -247,8 +247,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the Gateway specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The cancellation token to use. @@ -280,8 +280,8 @@ public async Task> GetAsync(string subscripti } /// Gets the details of the Gateway specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The cancellation token to use. @@ -343,8 +343,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates a Gateway to be used in Api Management instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The ApiManagementGateway to use. @@ -378,8 +378,8 @@ public async Task> CreateOrUpdateAsync(string } /// Creates or updates a Gateway to be used in Api Management instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The ApiManagementGateway to use. @@ -440,8 +440,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the details of the gateway specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// 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. @@ -474,8 +474,8 @@ public async Task> UpdateAsync(string subscri } /// Updates the details of the gateway specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// 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. @@ -531,8 +531,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// 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. @@ -559,8 +559,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific Gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// 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. @@ -610,8 +610,8 @@ internal HttpMessage CreateListKeysRequest(string subscriptionId, string resourc } /// Retrieves gateway keys. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The cancellation token to use. @@ -641,8 +641,8 @@ public async Task> ListKeysAsync(string subscripti } /// Retrieves gateway keys. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The cancellation token to use. @@ -699,8 +699,8 @@ internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string re } /// Regenerates specified gateway key invalidating any tokens created with it. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The GatewayKeyRegenerateContent to use. @@ -727,8 +727,8 @@ public async Task RegenerateKeyAsync(string subscriptionId, string res } /// Regenerates specified gateway key invalidating any tokens created with it. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The GatewayKeyRegenerateContent to use. @@ -782,8 +782,8 @@ internal HttpMessage CreateGenerateTokenRequest(string subscriptionId, string re } /// Gets the Shared Access Authorization Token for the gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The GatewayTokenRequestContract to use. @@ -815,8 +815,8 @@ public async Task> GenerateTokenAsync(string subs } /// Gets the Shared Access Authorization Token for the gateway. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The GatewayTokenRequestContract to use. @@ -863,8 +863,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of gateways registered with service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| region | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -897,8 +897,8 @@ public async Task> ListByServiceNextPageAsync(string /// Lists a collection of gateways registered with service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| region | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GlobalSchemaRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GlobalSchemaRestOperations.cs index fd541b91c8c4..e9461622edd0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GlobalSchemaRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GlobalSchemaRestOperations.cs @@ -33,7 +33,7 @@ public GlobalSchemaRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of schemas registered with service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(string su } /// Lists a collection of schemas registered with service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the Schema specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Schema id identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -191,8 +191,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the Schema specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Schema id identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -247,8 +247,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the Schema specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Schema id identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -280,8 +280,8 @@ public async Task> GetAsync(string subsc } /// Gets the details of the Schema specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Schema id identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -343,8 +343,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates new or updates existing specified Schema of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Schema id identifier. Must be unique in the current API Management service instance. /// Create or update parameters. @@ -374,8 +374,8 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates new or updates existing specified Schema of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Schema id identifier. Must be unique in the current API Management service instance. /// Create or update parameters. @@ -428,8 +428,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific Schema. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Schema id identifier. Must be unique in the current API Management service instance. /// 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. @@ -456,8 +456,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific Schema. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Schema id identifier. Must be unique in the current API Management service instance. /// 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. @@ -499,8 +499,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of schemas registered with service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -533,8 +533,8 @@ public async Task> ListByServiceNextPageAsync(s /// Lists a collection of schemas registered with service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GraphQLApiResolverPolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GraphQLApiResolverPolicyRestOperations.cs new file mode 100644 index 000000000000..bc11e4416f48 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GraphQLApiResolverPolicyRestOperations.cs @@ -0,0 +1,618 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class GraphQLApiResolverPolicyRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of GraphQLApiResolverPolicyRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public GraphQLApiResolverPolicyRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByResolverRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendPath("/policies", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the list of policy configuration at the GraphQL API Resolver level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByResolverAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateListByResolverRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the list of policy configuration at the GraphQL API Resolver level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByResolver(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateListByResolverRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the GraphQL API resolver policy specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the GraphQL API resolver policy specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, PolicyExportFormat? format) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + if (format != null) + { + uri.AppendQuery("format", format.Value.ToString(), true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy configuration at the GraphQL API Resolver level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId, format); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy configuration at the GraphQL API Resolver level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId, format); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, PolicyContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates policy configuration for the GraphQL API Resolver level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates policy configuration for the GraphQL API Resolver level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the policy configuration at the GraphQL Api Resolver. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the policy configuration at the GraphQL Api Resolver. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, policyId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResolverNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the list of policy configuration at the GraphQL API Resolver level. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByResolverNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateListByResolverNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the list of policy configuration at the GraphQL API Resolver level. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByResolverNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateListByResolverNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GraphQLApiResolverRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GraphQLApiResolverRestOperations.cs new file mode 100644 index 000000000000..ebeb20a7677a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GraphQLApiResolverRestOperations.cs @@ -0,0 +1,711 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class GraphQLApiResolverRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of GraphQLApiResolverRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public GraphQLApiResolverRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByApiRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the resolvers for the specified GraphQL API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApiAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, apiId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResolverListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResolverListResult.DeserializeResolverListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the resolvers for the specified GraphQL API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByApi(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, apiId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResolverListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResolverListResult.DeserializeResolverListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the GraphQL API resolver specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the GraphQL API resolver specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the GraphQL API Resolver specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResolverContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResolverContractData.DeserializeResolverContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ResolverContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the GraphQL API Resolver specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResolverContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResolverContractData.DeserializeResolverContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ResolverContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, ResolverContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates a new resolver in the GraphQL API or updates an existing one. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, ResolverContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ResolverContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResolverContractData.DeserializeResolverContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a new resolver in the GraphQL API or updates an existing one. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, ResolverContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ResolverContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResolverContractData.DeserializeResolverContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, ETag ifMatch, ResolverContractPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the resolver in the GraphQL API specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// 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. + /// GraphQL API Resolver Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, ETag ifMatch, ResolverContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, ifMatch, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResolverContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResolverContractData.DeserializeResolverContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the resolver in the GraphQL API specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// 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. + /// GraphQL API Resolver Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, ETag ifMatch, ResolverContractPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, ifMatch, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResolverContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResolverContractData.DeserializeResolverContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/resolvers/", false); + uri.AppendPath(resolverId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified resolver in the GraphQL API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified resolver in the GraphQL API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(resolverId, nameof(resolverId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, apiId, resolverId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByApiNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string apiId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the resolvers for the specified GraphQL API. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApiNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, apiId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResolverListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResolverListResult.DeserializeResolverListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the resolvers for the specified GraphQL API. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// 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. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByApiNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, apiId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResolverListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResolverListResult.DeserializeResolverListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupRestOperations.cs index d2b9d5b8f780..2849aafd1b5e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupRestOperations.cs @@ -33,7 +33,7 @@ public GroupRestOperations(HttpPipeline pipeline, string applicationId, Uri endp { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of groups defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(string subscript } /// Lists a collection of groups defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the group specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -191,8 +191,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the group specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -247,8 +247,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the group specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -280,8 +280,8 @@ public async Task> GetAsync(string subscription } /// Gets the details of the group specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -312,7 +312,7 @@ public Response Get(string subscriptionId, string resour } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string groupId, ApiManagementGroupCreateOrUpdateContent content, ETag? ifMatch) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -335,32 +335,32 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(groupCreateParameters); + request.Content = content; _userAgent.Apply(message); return message; } /// Creates or Updates a group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. - /// Create parameters. + /// Create parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string groupId, ApiManagementGroupCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(groupCreateParameters, nameof(groupCreateParameters)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, groupId, content, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, groupId, groupCreateParameters, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -378,24 +378,24 @@ public async Task> CreateOrUpdateAsync(string s } /// Creates or Updates a group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. - /// Create parameters. + /// Create parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string groupId, ApiManagementGroupCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(groupCreateParameters, nameof(groupCreateParameters)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, groupId, content, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, groupId, groupCreateParameters, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -412,7 +412,7 @@ public Response CreateOrUpdate(string subscriptionId, st } } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string groupId, ETag ifMatch, ApiManagementGroupPatch patch) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string groupId, ETag ifMatch, GroupUpdateParameters groupUpdateParameters) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -433,31 +433,31 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); + content.JsonWriter.WriteObjectValue(groupUpdateParameters); request.Content = content; _userAgent.Apply(message); return message; } /// Updates the details of the group specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// 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. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string groupId, ETag ifMatch, ApiManagementGroupPatch patch, CancellationToken cancellationToken = default) + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string groupId, ETag ifMatch, GroupUpdateParameters groupUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(groupUpdateParameters, nameof(groupUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, groupId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, groupId, ifMatch, groupUpdateParameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -474,24 +474,24 @@ public async Task> UpdateAsync(string subscript } /// Updates the details of the group specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// 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. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string groupId, ETag ifMatch, ApiManagementGroupPatch patch, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string groupId, ETag ifMatch, GroupUpdateParameters groupUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(groupUpdateParameters, nameof(groupUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, groupId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, groupId, ifMatch, groupUpdateParameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -531,8 +531,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific group of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// 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. @@ -559,8 +559,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific group of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// 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. @@ -602,8 +602,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of groups defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. /// Number of records to return. @@ -636,8 +636,8 @@ public async Task> ListByServiceNextPageAsync(string n /// Lists a collection of groups defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupUserRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupUserRestOperations.cs index d184feb34eaf..9e17f9c8ef49 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupUserRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/GroupUserRestOperations.cs @@ -33,7 +33,7 @@ public GroupUserRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// Lists a collection of user entities associated with the group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListAsync(string s } /// Lists a collection of user entities associated with the group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateCheckEntityExistsRequest(string subscriptionId, strin } /// Checks that user entity specified by identifier is associated with the group entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// User identifier. Must be unique in the current API Management service instance. @@ -201,8 +201,8 @@ public async Task> CheckEntityExistsAsync(string subscriptionId, } /// Checks that user entity specified by identifier is associated with the group entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// User identifier. Must be unique in the current API Management service instance. @@ -261,8 +261,8 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG } /// Add existing user to existing group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// User identifier. Must be unique in the current API Management service instance. @@ -295,8 +295,8 @@ public async Task> CreateAsync(string subsc } /// Add existing user to existing group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// User identifier. Must be unique in the current API Management service instance. @@ -353,8 +353,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Remove existing user from existing group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// User identifier. Must be unique in the current API Management service instance. @@ -382,8 +382,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Remove existing user from existing group. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// User identifier. Must be unique in the current API Management service instance. @@ -426,8 +426,8 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists a collection of user entities associated with the group. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -462,8 +462,8 @@ public async Task> ListNextPageAsync( /// Lists a collection of user entities associated with the group. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Group identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IdentityProviderRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IdentityProviderRestOperations.cs index 378aa6d7cccd..40d1cfa7e5d5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IdentityProviderRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IdentityProviderRestOperations.cs @@ -33,7 +33,7 @@ public IdentityProviderRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of Identity Provider configured in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> ListByServiceAsync(string subs } /// Lists a collection of Identity Provider configured in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -139,8 +139,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the identityProvider specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// The cancellation token to use. @@ -172,8 +172,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the identityProvider specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// The cancellation token to use. @@ -227,8 +227,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the configuration details of the identity Provider configured in specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// The cancellation token to use. @@ -259,8 +259,8 @@ public async Task> GetAsync(string s } /// Gets the configuration details of the identity Provider configured in specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// The cancellation token to use. @@ -321,8 +321,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or Updates the IdentityProvider configuration. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// Create parameters. @@ -355,8 +355,8 @@ public async Task> CreateOrUpdateAsy } /// Creates or Updates the IdentityProvider configuration. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// Create parameters. @@ -416,8 +416,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates an existing IdentityProvider configuration. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// 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. @@ -449,8 +449,8 @@ public async Task> UpdateAsync(strin } /// Updates an existing IdentityProvider configuration. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// 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. @@ -505,8 +505,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified identity provider configuration. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// 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. @@ -532,8 +532,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified identity provider configuration. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// 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. @@ -582,8 +582,8 @@ internal HttpMessage CreateListSecretsRequest(string subscriptionId, string reso } /// Gets the client secret details of the Identity Provider. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// The cancellation token to use. @@ -612,8 +612,8 @@ public async Task> ListSecretsAsync(string subscr } /// Gets the client secret details of the Identity Provider. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identity Provider Type identifier. /// The cancellation token to use. @@ -657,8 +657,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of Identity Provider configured in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , , or is null. @@ -688,8 +688,8 @@ public async Task> ListByServiceNextPageAsync(str /// Lists a collection of Identity Provider configured in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , , or is null. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IssueRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IssueRestOperations.cs index d08359464c46..ec06e9abce44 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IssueRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/IssueRestOperations.cs @@ -33,7 +33,7 @@ public IssueRestOperations(HttpPipeline pipeline, string applicationId, Uri endp { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of issues in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| authorName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(string subscript } /// Lists a collection of issues in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| authorName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets API Management issue details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Issue identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -190,8 +190,8 @@ public async Task> GetAsync(string subscriptionId, s } /// Gets API Management issue details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Issue identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -238,8 +238,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of issues in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| authorName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>. /// Number of records to return. @@ -272,8 +272,8 @@ public async Task> ListByServiceNextPageAsync(string n /// Lists a collection of issues in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| title | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| authorName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/LoggerRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/LoggerRestOperations.cs index 31ff806591be..e0b254eb8c9c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/LoggerRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/LoggerRestOperations.cs @@ -33,7 +33,7 @@ public LoggerRestOperations(HttpPipeline pipeline, string applicationId, Uri end { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of loggers in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| loggerType | filter | eq | |</br>| resourceId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(string subscrip } /// Lists a collection of loggers in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| loggerType | filter | eq | |</br>| resourceId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the logger specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// The cancellation token to use. @@ -191,8 +191,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the logger specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// The cancellation token to use. @@ -247,8 +247,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the logger specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// The cancellation token to use. @@ -280,8 +280,8 @@ public async Task> GetAsync(string subscriptio } /// Gets the details of the logger specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// The cancellation token to use. @@ -343,8 +343,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or Updates a logger. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// Create parameters. @@ -378,8 +378,8 @@ public async Task> CreateOrUpdateAsync(string } /// Creates or Updates a logger. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// Create parameters. @@ -440,8 +440,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates an existing logger. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// 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. @@ -474,8 +474,8 @@ public async Task> UpdateAsync(string subscrip } /// Updates an existing logger. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// 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. @@ -531,8 +531,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified logger. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// 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. @@ -559,8 +559,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified logger. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Logger identifier. Must be unique in the API Management service instance. /// 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. @@ -602,8 +602,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of loggers in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| loggerType | filter | eq | |</br>| resourceId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -636,8 +636,8 @@ public async Task> ListByServiceNextPageAsync(string /// Lists a collection of loggers in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| loggerType | filter | eq | |</br>| resourceId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NamedValueRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NamedValueRestOperations.cs index 77ffcce7803f..be858fde4a5f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NamedValueRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NamedValueRestOperations.cs @@ -33,7 +33,7 @@ public NamedValueRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -75,8 +75,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of named values defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -108,8 +108,8 @@ public async Task> ListByServiceAsync(string subs } /// Lists a collection of named values defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -163,8 +163,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the named value specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// The cancellation token to use. @@ -197,8 +197,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the named value specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// The cancellation token to use. @@ -253,8 +253,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the named value specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// The cancellation token to use. @@ -286,8 +286,8 @@ public async Task> GetAsync(string subscri } /// Gets the details of the named value specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// The cancellation token to use. @@ -318,7 +318,7 @@ public Response Get(string subscriptionId, string r } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, ApiManagementNamedValueCreateOrUpdateContent content, ETag? ifMatch) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -341,32 +341,32 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(namedValueCreateContract); + request.Content = content; _userAgent.Apply(message); return message; } /// Creates or updates named value. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. - /// Create parameters. + /// Create parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, ApiManagementNamedValueCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(namedValueCreateContract, nameof(namedValueCreateContract)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, namedValueId, content, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, namedValueId, namedValueCreateContract, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -380,24 +380,24 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates or updates named value. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. - /// Create parameters. + /// Create parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, ApiManagementNamedValueCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(namedValueCreateContract, nameof(namedValueCreateContract)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, namedValueId, content, ifMatch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, namedValueId, namedValueCreateContract, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -410,7 +410,7 @@ public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, } } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, ETag ifMatch, ApiManagementNamedValuePatch patch) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -431,31 +431,31 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); + content.JsonWriter.WriteObjectValue(namedValueUpdateParameters); request.Content = content; _userAgent.Apply(message); return message; } /// Updates the specific named value. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// 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. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, ETag ifMatch, ApiManagementNamedValuePatch patch, CancellationToken cancellationToken = default) + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(namedValueUpdateParameters, nameof(namedValueUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, namedValueId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, namedValueId, ifMatch, namedValueUpdateParameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -468,24 +468,24 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Updates the specific named value. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// 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. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, ETag ifMatch, ApiManagementNamedValuePatch patch, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(namedValueUpdateParameters, nameof(namedValueUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, namedValueId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, namedValueId, ifMatch, namedValueUpdateParameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -521,8 +521,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific named value from the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// 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. @@ -549,8 +549,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific named value from the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// 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. @@ -600,8 +600,8 @@ internal HttpMessage CreateListValueRequest(string subscriptionId, string resour } /// Gets the secret of the named value specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// The cancellation token to use. @@ -631,8 +631,8 @@ public async Task> ListValueAsync(string subs } /// Gets the secret of the named value specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// The cancellation token to use. @@ -685,8 +685,8 @@ internal HttpMessage CreateRefreshSecretRequest(string subscriptionId, string re } /// Refresh the secret of the named value specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// The cancellation token to use. @@ -712,8 +712,8 @@ public async Task RefreshSecretAsync(string subscriptionId, string res } /// Refresh the secret of the named value specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the NamedValue. /// The cancellation token to use. @@ -754,8 +754,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of named values defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -789,8 +789,8 @@ public async Task> ListByServiceNextPageAsync(str /// Lists a collection of named values defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NetworkStatusRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NetworkStatusRestOperations.cs index f948fbc9c45c..c1fdc5fd20fd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NetworkStatusRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NetworkStatusRestOperations.cs @@ -34,7 +34,7 @@ public NetworkStatusRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -60,8 +60,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Gets the Connectivity Status to the external resources on which the Api Management service depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -94,8 +94,8 @@ public async Task>> Li } /// Gets the Connectivity Status to the external resources on which the Api Management service depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -151,8 +151,8 @@ internal HttpMessage CreateListByLocationRequest(string subscriptionId, string r } /// Gets the Connectivity Status to the external resources on which the Api Management service depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Location in which the API Management service is deployed. This is one of the Azure Regions like West US, East US, South Central US. /// The cancellation token to use. @@ -181,8 +181,8 @@ public async Task> ListByLocationAsync(string su } /// Gets the Connectivity Status to the external resources on which the Api Management service depends from inside the Cloud Service. This also returns the DNS Servers as visible to the CloudService. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Location in which the API Management service is deployed. This is one of the Azure Regions like West US, East US, South Central US. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRecipientEmailRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRecipientEmailRestOperations.cs index ec774781433e..c911a17758b9 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRecipientEmailRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRecipientEmailRestOperations.cs @@ -33,7 +33,7 @@ public NotificationRecipientEmailRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -61,8 +61,8 @@ internal HttpMessage CreateListByNotificationRequest(string subscriptionId, stri } /// Gets the list of the Notification Recipient Emails subscribed to a notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// The cancellation token to use. @@ -91,8 +91,8 @@ public async Task> ListByNotificationAsync(st } /// Gets the list of the Notification Recipient Emails subscribed to a notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// The cancellation token to use. @@ -145,8 +145,8 @@ internal HttpMessage CreateCheckEntityExistsRequest(string subscriptionId, strin } /// Determine if Notification Recipient Email subscribed to the notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// Email identifier. @@ -180,8 +180,8 @@ public async Task> CheckEntityExistsAsync(string subscriptionId, } /// Determine if Notification Recipient Email subscribed to the notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// Email identifier. @@ -239,8 +239,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Adds the Email address to the list of Recipients for the Notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// Email identifier. @@ -272,8 +272,8 @@ public async Task> CreateOrUpdateAsync(string s } /// Adds the Email address to the list of Recipients for the Notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// Email identifier. @@ -329,8 +329,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Removes the email from the list of Notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// Email identifier. @@ -357,8 +357,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Removes the email from the list of Notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// Email identifier. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRecipientUserRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRecipientUserRestOperations.cs index 693f735626df..be5d492f3f50 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRecipientUserRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRecipientUserRestOperations.cs @@ -33,7 +33,7 @@ public NotificationRecipientUserRestOperations(HttpPipeline pipeline, string app { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -61,8 +61,8 @@ internal HttpMessage CreateListByNotificationRequest(string subscriptionId, stri } /// Gets the list of the Notification Recipient User subscribed to the notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// The cancellation token to use. @@ -91,8 +91,8 @@ public async Task> ListByNotificationAsync(str } /// Gets the list of the Notification Recipient User subscribed to the notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// The cancellation token to use. @@ -145,8 +145,8 @@ internal HttpMessage CreateCheckEntityExistsRequest(string subscriptionId, strin } /// Determine if the Notification Recipient User is subscribed to the notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// User identifier. Must be unique in the current API Management service instance. @@ -180,8 +180,8 @@ public async Task> CheckEntityExistsAsync(string subscriptionId, } /// Determine if the Notification Recipient User is subscribed to the notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// User identifier. Must be unique in the current API Management service instance. @@ -239,8 +239,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Adds the API Management User to the list of Recipients for the Notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// User identifier. Must be unique in the current API Management service instance. @@ -272,8 +272,8 @@ public async Task> CreateOrUpdateAsync(string su } /// Adds the API Management User to the list of Recipients for the Notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// User identifier. Must be unique in the current API Management service instance. @@ -329,8 +329,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Removes the API Management user from the list of Notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// User identifier. Must be unique in the current API Management service instance. @@ -357,8 +357,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Removes the API Management user from the list of Notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// User identifier. Must be unique in the current API Management service instance. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRestOperations.cs index 89141a266e84..0abc9d154b87 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/NotificationRestOperations.cs @@ -33,7 +33,7 @@ public NotificationRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -67,8 +67,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of properties defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Number of records to return. /// Number of records to skip. @@ -98,8 +98,8 @@ public async Task> ListByServiceAsync(string su } /// Lists a collection of properties defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Number of records to return. /// Number of records to skip. @@ -151,8 +151,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the Notification specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// The cancellation token to use. @@ -183,8 +183,8 @@ public async Task> GetAsync(string subsc } /// Gets the details of the Notification specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// The cancellation token to use. @@ -241,8 +241,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Create or Update API Management publisher notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. @@ -272,8 +272,8 @@ public async Task> CreateOrUpdateAsync(s } /// Create or Update API Management publisher notification. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Notification Name Identifier. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. @@ -318,8 +318,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of properties defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Number of records to return. /// Number of records to skip. @@ -351,8 +351,8 @@ public async Task> ListByServiceNextPageAsync(s /// Lists a collection of properties defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Number of records to return. /// Number of records to skip. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OpenIdConnectProviderRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OpenIdConnectProviderRestOperations.cs index 9440dca4fcfb..10e20402d138 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OpenIdConnectProviderRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OpenIdConnectProviderRestOperations.cs @@ -33,7 +33,7 @@ public OpenIdConnectProviderRestOperations(HttpPipeline pipeline, string applica { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists of all the OpenId Connect Providers. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync( } /// Lists of all the OpenId Connect Providers. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the openIdConnectProvider specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// The cancellation token to use. @@ -191,8 +191,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the openIdConnectProvider specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// The cancellation token to use. @@ -247,8 +247,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets specific OpenID Connect Provider without secrets. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// The cancellation token to use. @@ -280,8 +280,8 @@ public async Task> GetAsync(str } /// Gets specific OpenID Connect Provider without secrets. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// The cancellation token to use. @@ -343,8 +343,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates the OpenID Connect Provider. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// Create parameters. @@ -378,8 +378,8 @@ public async Task> CreateOrUpda } /// Creates or updates the OpenID Connect Provider. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// Create parameters. @@ -440,8 +440,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the specific OpenID Connect Provider. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// 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. @@ -474,8 +474,8 @@ public async Task> UpdateAsync( } /// Updates the specific OpenID Connect Provider. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// 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. @@ -531,8 +531,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific OpenID Connect Provider of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// 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. @@ -559,8 +559,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific OpenID Connect Provider of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// 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. @@ -610,8 +610,8 @@ internal HttpMessage CreateListSecretsRequest(string subscriptionId, string reso } /// Gets the client secret details of the OpenID Connect Provider. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// The cancellation token to use. @@ -641,8 +641,8 @@ public async Task> ListSecretsAsync(string subscr } /// Gets the client secret details of the OpenID Connect Provider. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Identifier of the OpenID Connect Provider. /// The cancellation token to use. @@ -687,8 +687,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists of all the OpenId Connect Providers. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -721,8 +721,8 @@ public async Task> ListByServiceNextPa /// Lists of all the OpenId Connect Providers. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OperationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OperationRestOperations.cs index 11ff847f05ec..63c1abd95885 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OperationRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OperationRestOperations.cs @@ -33,7 +33,7 @@ public OperationRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -77,8 +77,8 @@ internal HttpMessage CreateListByTagsRequest(string subscriptionId, string resou } /// Lists a collection of operations associated with tags. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -112,8 +112,8 @@ public async Task> ListByTagsAsync(string subscr } /// Lists a collection of operations associated with tags. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -162,8 +162,8 @@ internal HttpMessage CreateListByTagsNextPageRequest(string nextLink, string sub /// Lists a collection of operations associated with tags. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -199,8 +199,8 @@ public async Task> ListByTagsNextPageAsync(strin /// Lists a collection of operations associated with tags. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OutboundNetworkDependenciesEndpointsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OutboundNetworkDependenciesEndpointsRestOperations.cs index 6d3684c38d52..0870ad14ae02 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OutboundNetworkDependenciesEndpointsRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/OutboundNetworkDependenciesEndpointsRestOperations.cs @@ -33,7 +33,7 @@ public OutboundNetworkDependenciesEndpointsRestOperations(HttpPipeline pipeline, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Gets the network endpoints of all outbound dependencies of a ApiManagement service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> ListByServiceAsync( } /// Gets the network endpoints of all outbound dependencies of a ApiManagement service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyDescriptionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyDescriptionRestOperations.cs index 6609aeb8ad4e..c568747c687e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyDescriptionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyDescriptionRestOperations.cs @@ -33,7 +33,7 @@ public PolicyDescriptionRestOperations(HttpPipeline pipeline, string application { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -63,8 +63,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all policy descriptions. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Policy scope. /// The cancellation token to use. @@ -93,8 +93,8 @@ public async Task> ListByServiceAsync(stri } /// Lists all policy descriptions. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Policy scope. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyFragmentRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyFragmentRestOperations.cs new file mode 100644 index 000000000000..1bffc2960444 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyFragmentRestOperations.cs @@ -0,0 +1,595 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class PolicyFragmentRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of PolicyFragmentRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public PolicyFragmentRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string filter, string orderBy, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/policyFragments", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (orderBy != null) + { + uri.AppendQuery("$orderby", orderBy, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets all policy fragments. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, filter, orderBy, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyFragmentListResult.DeserializePolicyFragmentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all policy fragments. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, filter, orderBy, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyFragmentListResult.DeserializePolicyFragmentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string id) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of a policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, id); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of a policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, id); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string id, PolicyFragmentContentFormat? format) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (format != null) + { + uri.AppendQuery("format", format.Value.ToString(), true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, id, format); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyFragmentContractData.DeserializePolicyFragmentContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyFragmentContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, id, format); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyFragmentContractData.DeserializePolicyFragmentContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyFragmentContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string id, PolicyFragmentContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string id, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, id, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates a policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string id, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, id, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string id, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// 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. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string id, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, id, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// 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. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string id, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, id, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListReferencesRequest(string subscriptionId, string resourceGroupName, string serviceName, string id, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendPath("/listReferences", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists policy resources that reference the policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListReferencesAsync(string subscriptionId, string resourceGroupName, string serviceName, string id, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateListReferencesRequest(subscriptionId, resourceGroupName, serviceName, id, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResourceListResult.DeserializeResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists policy resources that reference the policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// A resource identifier. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListReferences(string subscriptionId, string resourceGroupName, string serviceName, string id, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateListReferencesRequest(subscriptionId, resourceGroupName, serviceName, id, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResourceListResult.DeserializeResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyRestOperations.cs index bfcb2325068f..300714a25302 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PolicyRestOperations.cs @@ -33,7 +33,7 @@ public PolicyRestOperations(HttpPipeline pipeline, string applicationId, Uri end { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all the Global Policy definitions of the Api Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> ListByServiceAsync(string subscrip } /// Lists all the Global Policy definitions of the Api Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -139,8 +139,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the Global policy definition in the Api Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Policy. /// The cancellation token to use. @@ -172,8 +172,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the Global policy definition in the Api Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Policy. /// The cancellation token to use. @@ -231,8 +231,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get the Global policy definition of the Api Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Policy. /// Policy Export Format. @@ -264,8 +264,8 @@ public async Task> GetAsync(string subscriptionId, } /// Get the Global policy definition of the Api Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Policy. /// Policy Export Format. @@ -327,8 +327,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates the global policy configuration of the Api Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Policy. /// The policy contents to apply. @@ -361,8 +361,8 @@ public async Task> CreateOrUpdateAsync(string subsc } /// Creates or updates the global policy configuration of the Api Management service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Policy. /// The policy contents to apply. @@ -418,8 +418,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the global policy configuration of the Api Management Service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Policy. /// 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. @@ -445,8 +445,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the global policy configuration of the Api Management Service. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Policy. /// 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. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalConfigRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalConfigRestOperations.cs new file mode 100644 index 000000000000..a1063774c8c3 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalConfigRestOperations.cs @@ -0,0 +1,487 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class PortalConfigRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of PortalConfigRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public PortalConfigRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/portalconfigs", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the developer portal configurations. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PortalConfigListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PortalConfigListResult.DeserializePortalConfigListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the developer portal configurations. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PortalConfigListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PortalConfigListResult.DeserializePortalConfigListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/portalconfigs/", false); + uri.AppendPath(portalConfigId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the developer portal configuration. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Portal configuration identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, portalConfigId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the developer portal configuration. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Portal configuration identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, portalConfigId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/portalconfigs/", false); + uri.AppendPath(portalConfigId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the developer portal configuration. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Portal configuration identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, portalConfigId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PortalConfigContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PortalConfigContractData.DeserializePortalConfigContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PortalConfigContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the developer portal configuration. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Portal configuration identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, portalConfigId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PortalConfigContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PortalConfigContractData.DeserializePortalConfigContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PortalConfigContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, ETag ifMatch, PortalConfigContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/portalconfigs/", false); + uri.AppendPath(portalConfigId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update the developer portal configuration. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Portal configuration identifier. + /// 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. + /// Update the developer portal configuration. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, ETag ifMatch, PortalConfigContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, portalConfigId, ifMatch, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PortalConfigContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PortalConfigContractData.DeserializePortalConfigContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update the developer portal configuration. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Portal configuration identifier. + /// 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. + /// Update the developer portal configuration. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, ETag ifMatch, PortalConfigContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, portalConfigId, ifMatch, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PortalConfigContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PortalConfigContractData.DeserializePortalConfigContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, ETag ifMatch, PortalConfigContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/portalconfigs/", false); + uri.AppendPath(portalConfigId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or update the developer portal configuration. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Portal configuration identifier. + /// 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. + /// Update the developer portal configuration. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, ETag ifMatch, PortalConfigContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, portalConfigId, ifMatch, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PortalConfigContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PortalConfigContractData.DeserializePortalConfigContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or update the developer portal configuration. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Portal configuration identifier. + /// 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. + /// Update the developer portal configuration. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string portalConfigId, ETag ifMatch, PortalConfigContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(portalConfigId, nameof(portalConfigId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, portalConfigId, ifMatch, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PortalConfigContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PortalConfigContractData.DeserializePortalConfigContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalRevisionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalRevisionRestOperations.cs index 5f7b8e0eb940..ac3d1c3844dd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalRevisionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalRevisionRestOperations.cs @@ -33,7 +33,7 @@ public PortalRevisionRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists developer portal's revisions. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// /// | Field | Supported operators | Supported functions | @@ -111,8 +111,8 @@ public async Task> ListByServiceAsync(string } /// Lists developer portal's revisions. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// /// | Field | Supported operators | Supported functions | @@ -173,8 +173,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the developer portal revision specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Portal revision identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -207,8 +207,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the developer portal revision specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Portal revision identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -263,8 +263,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the developer portal's revision specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Portal revision identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -296,8 +296,8 @@ public async Task> GetAsync(string sub } /// Gets the developer portal's revision specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Portal revision identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -355,8 +355,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new developer portal's revision by running the portal's publishing. The `isCurrent` property indicates if the revision is publicly accessible. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Portal revision identifier. Must be unique in the current API Management service instance. /// The ApiManagementPortalRevision to use. @@ -384,8 +384,8 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates a new developer portal's revision by running the portal's publishing. The `isCurrent` property indicates if the revision is publicly accessible. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Portal revision identifier. Must be unique in the current API Management service instance. /// The ApiManagementPortalRevision to use. @@ -440,8 +440,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the description of specified portal revision or makes it current. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Portal revision identifier. Must be unique in the current API Management service instance. /// 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. @@ -470,8 +470,8 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Updates the description of specified portal revision or makes it current. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Portal revision identifier. Must be unique in the current API Management service instance. /// 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. @@ -515,8 +515,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists developer portal's revisions. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// /// | Field | Supported operators | Supported functions | @@ -557,8 +557,8 @@ public async Task> ListByServiceNextPageAsync /// Lists developer portal's revisions. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// /// | Field | Supported operators | Supported functions | diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalSettingsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalSettingsRestOperations.cs index 3172d33c04fa..dee453f39f00 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalSettingsRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PortalSettingsRestOperations.cs @@ -33,7 +33,7 @@ public PortalSettingsRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of portalsettings defined within a service instance.. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> ListByServiceAsync(string } /// Lists a collection of portalsettings defined within a service instance.. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PrivateEndpointConnectionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PrivateEndpointConnectionRestOperations.cs index 334c6d04d202..693d97f8e97b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PrivateEndpointConnectionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/PrivateEndpointConnectionRestOperations.cs @@ -33,7 +33,7 @@ public PrivateEndpointConnectionRestOperations(HttpPipeline pipeline, string app { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all private endpoint connections of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> Li } /// Lists all private endpoint connections of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -139,8 +139,8 @@ internal HttpMessage CreateGetByNameRequest(string subscriptionId, string resour } /// Gets the details of the Private Endpoint Connection specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Name of the private endpoint connection. /// The cancellation token to use. @@ -172,8 +172,8 @@ public async Task> GetByNam } /// Gets the details of the Private Endpoint Connection specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Name of the private endpoint connection. /// The cancellation token to use. @@ -231,8 +231,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new Private Endpoint Connection or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Name of the private endpoint connection. /// The ApiManagementPrivateEndpointConnectionCreateOrUpdateContent to use. @@ -260,8 +260,8 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates a new Private Endpoint Connection or updates an existing one. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Name of the private endpoint connection. /// The ApiManagementPrivateEndpointConnectionCreateOrUpdateContent to use. @@ -311,8 +311,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified Private Endpoint Connection. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Name of the private endpoint connection. /// The cancellation token to use. @@ -339,8 +339,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified Private Endpoint Connection. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Name of the private endpoint connection. /// The cancellation token to use. @@ -388,8 +388,8 @@ internal HttpMessage CreateListPrivateLinkResourcesRequest(string subscriptionId } /// Gets the private link resources. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -417,8 +417,8 @@ public async Task> ListPriv } /// Gets the private link resources. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -468,8 +468,8 @@ internal HttpMessage CreateGetPrivateLinkResourceRequest(string subscriptionId, } /// Gets the private link resources. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Name of the private link resource. /// The cancellation token to use. @@ -501,8 +501,8 @@ public async Task> GetPrivateLink } /// Gets the private link resources. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Name of the private link resource. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductApiLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductApiLinkRestOperations.cs new file mode 100644 index 000000000000..da791cb40c52 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductApiLinkRestOperations.cs @@ -0,0 +1,505 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class ProductApiLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ProductApiLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ProductApiLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/apiLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the API links associated with a product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, productId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductApiLinkListResult.DeserializeProductApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the API links associated with a product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, productId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductApiLinkListResult.DeserializeProductApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the API link for the product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, productId, apiLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductApiLinkContractData.DeserializeProductApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ProductApiLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the API link for the product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, productId, apiLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductApiLinkContractData.DeserializeProductApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ProductApiLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId, ProductApiLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds an API to the specified product via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, apiLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ProductApiLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductApiLinkContractData.DeserializeProductApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds an API to the specified product via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, apiLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ProductApiLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductApiLinkContractData.DeserializeProductApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified API from the specified product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, productId, apiLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified API from the specified product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, productId, apiLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the API links associated with a product. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, productId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductApiLinkListResult.DeserializeProductApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the API links associated with a product. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, productId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductApiLinkListResult.DeserializeProductApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductApiRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductApiRestOperations.cs index 4fd75fe05ef9..0eceda7177b4 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductApiRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductApiRestOperations.cs @@ -33,7 +33,7 @@ public ProductApiRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByProductRequest(string subscriptionId, string re } /// Lists a collection of the APIs associated with a product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListByProductAsyn } /// Lists a collection of the APIs associated with a product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateCheckEntityExistsRequest(string subscriptionId, strin } /// Checks that API entity specified by identifier is associated with the Product entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// 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. @@ -201,8 +201,8 @@ public async Task> CheckEntityExistsAsync(string subscriptionId, } /// Checks that API entity specified by identifier is associated with the Product entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// 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. @@ -261,8 +261,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Adds an API to the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// 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,8 +295,8 @@ public async Task> CreateOrUpdateAsync(string subscript } /// Adds an API to the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// 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. @@ -353,8 +353,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified API from the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// 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. @@ -382,8 +382,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified API from the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// 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. @@ -426,8 +426,8 @@ internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string /// Lists a collection of the APIs associated with a product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -462,8 +462,8 @@ public async Task> ListByProductNext /// Lists a collection of the APIs associated with a product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductGroupLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductGroupLinkRestOperations.cs new file mode 100644 index 000000000000..5ec25c6ff96b --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductGroupLinkRestOperations.cs @@ -0,0 +1,505 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class ProductGroupLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ProductGroupLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ProductGroupLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/groupLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the group links associated with a product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, productId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductGroupLinkListResult.DeserializeProductGroupLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the group links associated with a product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, productId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductGroupLinkListResult.DeserializeProductGroupLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/groupLinks/", false); + uri.AppendPath(groupLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the group link for the product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, productId, groupLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ProductGroupLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the group link for the product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, productId, groupLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ProductGroupLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId, ProductGroupLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/groupLinks/", false); + uri.AppendPath(groupLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds a group to the specified product via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, groupLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ProductGroupLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds a group to the specified product via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, groupLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ProductGroupLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/groupLinks/", false); + uri.AppendPath(groupLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified group from the specified product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, productId, groupLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified group from the specified product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, productId, groupLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the group links associated with a product. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, productId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductGroupLinkListResult.DeserializeProductGroupLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the group links associated with a product. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, productId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductGroupLinkListResult.DeserializeProductGroupLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductGroupRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductGroupRestOperations.cs index 28489ace25ad..fa2408eab97d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductGroupRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductGroupRestOperations.cs @@ -33,7 +33,7 @@ public ProductGroupRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListByProductRequest(string subscriptionId, string re } /// Lists the collection of developer groups associated with the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | |</br>| displayName | filter | eq, ne | |</br>| description | filter | eq, ne | |</br>. @@ -107,8 +107,8 @@ public async Task> ListByProductAs } /// Lists the collection of developer groups associated with the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | |</br>| displayName | filter | eq, ne | |</br>| description | filter | eq, ne | |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateCheckEntityExistsRequest(string subscriptionId, strin } /// Checks that Group entity specified by identifier is associated with the Product entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Group identifier. Must be unique in the current API Management service instance. @@ -201,8 +201,8 @@ public async Task> CheckEntityExistsAsync(string subscriptionId, } /// Checks that Group entity specified by identifier is associated with the Product entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Group identifier. Must be unique in the current API Management service instance. @@ -261,8 +261,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Adds the association between the specified developer group with the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Group identifier. Must be unique in the current API Management service instance. @@ -295,8 +295,8 @@ public async Task> CreateOrUpdateAsync(string subscri } /// Adds the association between the specified developer group with the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Group identifier. Must be unique in the current API Management service instance. @@ -353,8 +353,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the association between the specified group and product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Group identifier. Must be unique in the current API Management service instance. @@ -382,8 +382,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the association between the specified group and product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Group identifier. Must be unique in the current API Management service instance. @@ -426,8 +426,8 @@ internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string /// Lists the collection of developer groups associated with the specified product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | |</br>| displayName | filter | eq, ne | |</br>| description | filter | eq, ne | |</br>. @@ -462,8 +462,8 @@ public async Task> ListByProductNe /// Lists the collection of developer groups associated with the specified product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | |</br>| displayName | filter | eq, ne | |</br>| description | filter | eq, ne | |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductPolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductPolicyRestOperations.cs index e678181bea6d..5c2cae468e05 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductPolicyRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductPolicyRestOperations.cs @@ -33,7 +33,7 @@ public ProductPolicyRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -61,8 +61,8 @@ internal HttpMessage CreateListByProductRequest(string subscriptionId, string re } /// Get the policy configuration at the Product level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -92,8 +92,8 @@ public async Task> ListByProductAsync(string subscrip } /// Get the policy configuration at the Product level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -147,8 +147,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Get the ETag of the policy configuration at the Product level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The identifier of the Policy. @@ -182,8 +182,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Get the ETag of the policy configuration at the Product level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The identifier of the Policy. @@ -245,8 +245,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get the policy configuration at the Product level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The identifier of the Policy. @@ -280,8 +280,8 @@ public async Task> GetAsync(string subscriptionId, } /// Get the policy configuration at the Product level. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The identifier of the Policy. @@ -347,8 +347,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates policy configuration for the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The identifier of the Policy. @@ -383,8 +383,8 @@ public async Task> CreateOrUpdateAsync(string subsc } /// Creates or updates policy configuration for the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The identifier of the Policy. @@ -444,8 +444,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the policy configuration at the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The identifier of the Policy. @@ -473,8 +473,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the policy configuration at the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The identifier of the Policy. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductRestOperations.cs index 984cc09406b0..430d3dfec962 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductRestOperations.cs @@ -33,7 +33,7 @@ public ProductRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -79,8 +79,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of products in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. /// Number of records to return. @@ -113,8 +113,8 @@ public async Task> ListByServiceAsync(string subscri } /// Lists a collection of products in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. /// Number of records to return. @@ -169,8 +169,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the product specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -203,8 +203,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the product specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -259,8 +259,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the product specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -292,8 +292,8 @@ public async Task> GetAsync(string subscripti } /// Gets the details of the product specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -355,8 +355,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or Updates a product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Create or update parameters. @@ -390,8 +390,8 @@ public async Task> CreateOrUpdateAsync(string } /// Creates or Updates a product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Create or update parameters. @@ -424,7 +424,7 @@ public Response CreateOrUpdate(string subscriptionId, } } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, ApiManagementProductPatch patch) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, ProductUpdateParameters productUpdateParameters) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -445,31 +445,31 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); + content.JsonWriter.WriteObjectValue(productUpdateParameters); request.Content = content; _userAgent.Apply(message); return message; } /// Update existing product details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// 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. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, ApiManagementProductPatch patch, CancellationToken cancellationToken = default) + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, ProductUpdateParameters productUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(productId, nameof(productId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(productUpdateParameters, nameof(productUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, ifMatch, productUpdateParameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -486,24 +486,24 @@ public async Task> UpdateAsync(string subscri } /// Update existing product details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// 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. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, ApiManagementProductPatch patch, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, ProductUpdateParameters productUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(productId, nameof(productId)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(productUpdateParameters, nameof(productUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, ifMatch, patch); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, ifMatch, productUpdateParameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -547,8 +547,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Delete product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// 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. @@ -576,8 +576,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Delete product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// 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. @@ -642,8 +642,8 @@ internal HttpMessage CreateListByTagsRequest(string subscriptionId, string resou } /// Lists a collection of products associated with tags. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -675,8 +675,8 @@ public async Task> ListByTagsAsync(string subscr } /// Lists a collection of products associated with tags. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -723,8 +723,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of products in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. /// Number of records to return. @@ -759,8 +759,8 @@ public async Task> ListByServiceNextPageAsync(string /// Lists a collection of products in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. /// Number of records to return. @@ -809,8 +809,8 @@ internal HttpMessage CreateListByTagsNextPageRequest(string nextLink, string sub /// Lists a collection of products associated with tags. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -844,8 +844,8 @@ public async Task> ListByTagsNextPageAsync(strin /// Lists a collection of products associated with tags. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductSubscriptionsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductSubscriptionsRestOperations.cs index cf61410e2068..ca240a8523c5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductSubscriptionsRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductSubscriptionsRestOperations.cs @@ -33,7 +33,7 @@ public ProductSubscriptionsRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// Lists the collection of subscriptions to the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. @@ -107,8 +107,8 @@ public async Task> ListAsync(string subscriptio } /// Lists the collection of subscriptions to the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. @@ -156,8 +156,8 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists the collection of subscriptions to the specified product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. @@ -192,8 +192,8 @@ public async Task> ListNextPageAsync(string nex /// Lists the collection of subscriptions to the specified product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductWikiRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductWikiRestOperations.cs new file mode 100644 index 000000000000..84f1a01196f6 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ProductWikiRestOperations.cs @@ -0,0 +1,497 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class ProductWikiRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ProductWikiRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ProductWikiRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the Wiki for a Product specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, productId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the Wiki for a Product specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, productId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the Wiki for a Product specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, productId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WikiContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WikiContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the Wiki for a Product specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, productId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WikiContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WikiContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, WikiContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates a new Wiki for a Product or updates an existing one. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, WikiContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + WikiContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a new Wiki for a Product or updates an existing one. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string productId, WikiContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + WikiContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, WikiUpdateContract wikiUpdateContract) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(wikiUpdateContract); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the Wiki for a Product specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// 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. + /// Wiki Update parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, WikiUpdateContract wikiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(wikiUpdateContract, nameof(wikiUpdateContract)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, ifMatch, wikiUpdateContract); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WikiContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the Wiki for a Product specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// 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. + /// Wiki Update parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, WikiUpdateContract wikiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(wikiUpdateContract, nameof(wikiUpdateContract)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, productId, ifMatch, wikiUpdateContract); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WikiContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WikiContractData.DeserializeWikiContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/wikis/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified Wiki from a Product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, productId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified Wiki from a Product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Product identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string productId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, productId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByCounterKeysRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByCounterKeysRestOperations.cs index 776321f27d58..04de34d16e24 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByCounterKeysRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByCounterKeysRestOperations.cs @@ -33,7 +33,7 @@ public QuotaByCounterKeysRestOperations(HttpPipeline pipeline, string applicatio { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -60,8 +60,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of current quota counter periods associated with the counter-key configured in the policy on the specified service instance. The api does not support paging yet. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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 accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key. /// The cancellation token to use. @@ -91,8 +91,8 @@ public async Task> ListByServiceAsync(string su } /// Lists a collection of current quota counter periods associated with the counter-key configured in the policy on the specified service instance. The api does not support paging yet. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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 accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key. /// The cancellation token to use. @@ -148,8 +148,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates all the quota counter values specified with the existing quota counter key to a value in the specified service instance. This should be used for reset of the quota counter values. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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 accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key. /// The value of the quota counter to be applied to all quota counter periods. @@ -181,8 +181,8 @@ public async Task> UpdateAsync(string subscript } /// Updates all the quota counter values specified with the existing quota counter key to a value in the specified service instance. This should be used for reset of the quota counter values. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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 accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key. /// The value of the quota counter to be applied to all quota counter periods. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByPeriodKeysRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByPeriodKeysRestOperations.cs index 627d9ea25cb0..9665ef7d898b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByPeriodKeysRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/QuotaByPeriodKeysRestOperations.cs @@ -33,7 +33,7 @@ public QuotaByPeriodKeysRestOperations(HttpPipeline pipeline, string application { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -62,8 +62,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the value of the quota counter associated with the counter-key in the policy for the specific period in service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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 accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key. /// Quota period key identifier. @@ -95,8 +95,8 @@ public async Task> GetAsync(string subscriptionId } /// Gets the value of the quota counter associated with the counter-key in the policy for the specific period in service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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 accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key. /// Quota period key identifier. @@ -156,8 +156,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates an existing quota counter value in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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 accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key. /// Quota period key identifier. @@ -191,8 +191,8 @@ public async Task> UpdateAsync(string subscriptio } /// Updates an existing quota counter value in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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 accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key. /// Quota period key identifier. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/RegionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/RegionRestOperations.cs index f7d52add08f0..7e93c62e6e56 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/RegionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/RegionRestOperations.cs @@ -33,7 +33,7 @@ public RegionRestOperations(HttpPipeline pipeline, string applicationId, Uri end { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists all azure regions in which the service exists. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> ListByServiceAsync(string subscrip } /// Lists all azure regions in which the service exists. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -132,8 +132,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists all azure regions in which the service exists. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , , or is null. @@ -163,8 +163,8 @@ public async Task> ListByServiceNextPageAsync(string /// Lists all azure regions in which the service exists. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , , or is null. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ReportsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ReportsRestOperations.cs index aac9218c91ff..a1cbeb286634 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ReportsRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/ReportsRestOperations.cs @@ -33,7 +33,7 @@ public ReportsRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -72,8 +72,8 @@ internal HttpMessage CreateListByApiRequest(string subscriptionId, string resour } /// Lists report records by API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The filter to apply on the operation. /// Number of records to return. @@ -106,8 +106,8 @@ public async Task> ListByApiAsync(string subscription } /// Lists report records by API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The filter to apply on the operation. /// Number of records to return. @@ -174,8 +174,8 @@ internal HttpMessage CreateListByUserRequest(string subscriptionId, string resou } /// Lists report records by User. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| userId | select, filter | eq | | </br>| apiRegion | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -208,8 +208,8 @@ public async Task> ListByUserAsync(string subscriptio } /// Lists report records by User. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| userId | select, filter | eq | | </br>| apiRegion | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -276,8 +276,8 @@ internal HttpMessage CreateListByOperationRequest(string subscriptionId, string } /// Lists report records by API Operations. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -310,8 +310,8 @@ public async Task> ListByOperationAsync(string subscr } /// Lists report records by API Operations. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -378,8 +378,8 @@ internal HttpMessage CreateListByProductRequest(string subscriptionId, string re } /// Lists report records by Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -412,8 +412,8 @@ public async Task> ListByProductAsync(string subscrip } /// Lists report records by Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -476,8 +476,8 @@ internal HttpMessage CreateListByGeoRequest(string subscriptionId, string resour } /// Lists report records by geography. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| country | select | | | </br>| region | select | | | </br>| zip | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -509,8 +509,8 @@ public async Task> ListByGeoAsync(string subscription } /// Lists report records by geography. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| country | select | | | </br>| region | select | | | </br>| zip | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -576,8 +576,8 @@ internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, stri } /// Lists report records by subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | select, filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -610,8 +610,8 @@ public async Task> ListBySubscriptionAsync(string sub } /// Lists report records by subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | select, filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -679,8 +679,8 @@ internal HttpMessage CreateListByTimeRequest(string subscriptionId, string resou } /// Lists report records by Time. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter, select | ge, le | | </br>| interval | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// By time interval. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). @@ -714,8 +714,8 @@ public async Task> ListByTimeAsync(string subscriptio } /// Lists report records by Time. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter, select | ge, le | | </br>| interval | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// By time interval. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). @@ -779,8 +779,8 @@ internal HttpMessage CreateListByRequestRequest(string subscriptionId, string re } /// Lists report records by Request. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| productId | filter | eq | | </br>| userId | filter | eq | | </br>| apiRegion | filter | eq | | </br>| subscriptionId | filter | eq | | </br>. /// Number of records to return. @@ -812,8 +812,8 @@ public async Task> ListByRequestAsync(string s } /// Lists report records by Request. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| productId | filter | eq | | </br>| userId | filter | eq | | </br>| apiRegion | filter | eq | | </br>| subscriptionId | filter | eq | | </br>. /// Number of records to return. @@ -860,8 +860,8 @@ internal HttpMessage CreateListByApiNextPageRequest(string nextLink, string subs /// Lists report records by API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The filter to apply on the operation. /// Number of records to return. @@ -896,8 +896,8 @@ public async Task> ListByApiNextPageAsync(string next /// Lists report records by API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The filter to apply on the operation. /// Number of records to return. @@ -946,8 +946,8 @@ internal HttpMessage CreateListByUserNextPageRequest(string nextLink, string sub /// Lists report records by User. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| userId | select, filter | eq | | </br>| apiRegion | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -982,8 +982,8 @@ public async Task> ListByUserNextPageAsync(string nex /// Lists report records by User. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| userId | select, filter | eq | | </br>| apiRegion | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -1032,8 +1032,8 @@ internal HttpMessage CreateListByOperationNextPageRequest(string nextLink, strin /// Lists report records by API Operations. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -1068,8 +1068,8 @@ public async Task> ListByOperationNextPageAsync(strin /// Lists report records by API Operations. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -1118,8 +1118,8 @@ internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string /// Lists report records by Product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -1154,8 +1154,8 @@ public async Task> ListByProductNextPageAsync(string /// Lists report records by Product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -1204,8 +1204,8 @@ internal HttpMessage CreateListByGeoNextPageRequest(string nextLink, string subs /// Lists report records by geography. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| country | select | | | </br>| region | select | | | </br>| zip | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -1239,8 +1239,8 @@ public async Task> ListByGeoNextPageAsync(string next /// Lists report records by geography. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| country | select | | | </br>| region | select | | | </br>| zip | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -1288,8 +1288,8 @@ internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, st /// Lists report records by subscription. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | select, filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -1324,8 +1324,8 @@ public async Task> ListBySubscriptionNextPageAsync(st /// Lists report records by subscription. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter | ge, le | | </br>| displayName | select, orderBy | | | </br>| apiRegion | filter | eq | | </br>| userId | select, filter | eq | | </br>| productId | select, filter | eq | | </br>| subscriptionId | select, filter | eq | | </br>| callCountSuccess | select, orderBy | | | </br>| callCountBlocked | select, orderBy | | | </br>| callCountFailed | select, orderBy | | | </br>| callCountOther | select, orderBy | | | </br>| callCountTotal | select, orderBy | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select, orderBy | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// Number of records to return. @@ -1374,8 +1374,8 @@ internal HttpMessage CreateListByTimeNextPageRequest(string nextLink, string sub /// Lists report records by Time. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter, select | ge, le | | </br>| interval | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// By time interval. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). @@ -1411,8 +1411,8 @@ public async Task> ListByTimeNextPageAsync(string nex /// Lists report records by Time. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| timestamp | filter, select | ge, le | | </br>| interval | select | | | </br>| apiRegion | filter | eq | | </br>| userId | filter | eq | | </br>| productId | filter | eq | | </br>| subscriptionId | filter | eq | | </br>| apiId | filter | eq | | </br>| operationId | filter | eq | | </br>| callCountSuccess | select | | | </br>| callCountBlocked | select | | | </br>| callCountFailed | select | | | </br>| callCountOther | select | | | </br>| bandwidth | select, orderBy | | | </br>| cacheHitsCount | select | | | </br>| cacheMissCount | select | | | </br>| apiTimeAvg | select | | | </br>| apiTimeMin | select | | | </br>| apiTimeMax | select | | | </br>| serviceTimeAvg | select | | | </br>| serviceTimeMin | select | | | </br>| serviceTimeMax | select | | | </br>. /// By time interval. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)). diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignInSettingsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignInSettingsRestOperations.cs index deb05abf569f..dc5fcd2749bb 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignInSettingsRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignInSettingsRestOperations.cs @@ -32,7 +32,7 @@ public SignInSettingsRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -58,8 +58,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the SignInSettings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -90,8 +90,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the SignInSettings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -143,8 +143,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get Sign In Settings for the Portal. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -174,8 +174,8 @@ public async Task> GetAsync(strin } /// Get Sign In Settings for the Portal. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -231,8 +231,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Update Sign-In settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Update Sign-In settings. @@ -258,8 +258,8 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Update Sign-In settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Update Sign-In settings. @@ -314,8 +314,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Create or Update Sign-In settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. @@ -346,8 +346,8 @@ public async Task> CreateOrUpdate } /// Create or Update Sign-In settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignUpSettingsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignUpSettingsRestOperations.cs index 31a99a99d471..14fe07fdb4cc 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignUpSettingsRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SignUpSettingsRestOperations.cs @@ -32,7 +32,7 @@ public SignUpSettingsRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -58,8 +58,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the SignUpSettings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -90,8 +90,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the SignUpSettings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -143,8 +143,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get Sign Up Settings for the Portal. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -174,8 +174,8 @@ public async Task> GetAsync(strin } /// Get Sign Up Settings for the Portal. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The cancellation token to use. /// , or is null. @@ -231,8 +231,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Update Sign-Up settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Update Sign-Up settings. @@ -258,8 +258,8 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Update Sign-Up settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Update Sign-Up settings. @@ -314,8 +314,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Create or Update Sign-Up settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. @@ -346,8 +346,8 @@ public async Task> CreateOrUpdate } /// Create or Update Sign-Up settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SubscriptionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SubscriptionRestOperations.cs index d90936132959..0cf3e404d8fb 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SubscriptionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/SubscriptionRestOperations.cs @@ -33,7 +33,7 @@ public SubscriptionRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// Lists all subscriptions of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListAsync(string subscriptio } /// Lists all subscriptions of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. /// Number of records to return. @@ -157,8 +157,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -191,8 +191,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -247,8 +247,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the specified Subscription entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -280,8 +280,8 @@ public async Task> GetAsync(string subscripti } /// Gets the specified Subscription entity. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -312,7 +312,7 @@ public Response Get(string subscriptionId, string reso } } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string sid, ApiManagementSubscriptionCreateOrUpdateContent content, bool? notify, ETag? ifMatch, AppType? appType) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify, ETag? ifMatch, AppType? appType) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -343,19 +343,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(subscriptionCreateParameters); + request.Content = content; _userAgent.Apply(message); return message; } /// Creates or updates the subscription of specified user to the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. - /// Create parameters. + /// Create parameters. /// /// Notify change in Subscription State. /// - If false, do not send any email notification for change of state of subscription @@ -364,17 +364,17 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// Determines the type of application which send the create user request. Default is legacy publisher portal. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string sid, ApiManagementSubscriptionCreateOrUpdateContent content, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(sid, nameof(sid)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(subscriptionCreateParameters, nameof(subscriptionCreateParameters)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, sid, content, notify, ifMatch, appType); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, sid, subscriptionCreateParameters, notify, ifMatch, appType); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -392,11 +392,11 @@ public async Task> CreateOrUpdateAsync(string } /// Creates or updates the subscription of specified user to the specified product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. - /// Create parameters. + /// Create parameters. /// /// Notify change in Subscription State. /// - If false, do not send any email notification for change of state of subscription @@ -405,17 +405,17 @@ public async Task> CreateOrUpdateAsync(string /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// Determines the type of application which send the create user request. Default is legacy publisher portal. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string sid, ApiManagementSubscriptionCreateOrUpdateContent content, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(sid, nameof(sid)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(subscriptionCreateParameters, nameof(subscriptionCreateParameters)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, sid, content, notify, ifMatch, appType); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, sid, subscriptionCreateParameters, notify, ifMatch, appType); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -432,7 +432,7 @@ public Response CreateOrUpdate(string subscriptionId, } } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string sid, ETag ifMatch, ApiManagementSubscriptionPatch patch, bool? notify, AppType? appType) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string sid, ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify, AppType? appType) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -461,19 +461,19 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); + content.JsonWriter.WriteObjectValue(subscriptionUpdateParameters); request.Content = content; _userAgent.Apply(message); return message; } /// Updates the details of a subscription specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// 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. - /// Update parameters. + /// Update parameters. /// /// Notify change in Subscription State. /// - If false, do not send any email notification for change of state of subscription @@ -481,17 +481,17 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG /// /// Determines the type of application which send the create user request. Default is legacy publisher portal. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string sid, ETag ifMatch, ApiManagementSubscriptionPatch patch, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string sid, ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(sid, nameof(sid)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(subscriptionUpdateParameters, nameof(subscriptionUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, sid, ifMatch, patch, notify, appType); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, sid, ifMatch, subscriptionUpdateParameters, notify, appType); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -508,12 +508,12 @@ public async Task> UpdateAsync(string subscri } /// Updates the details of a subscription specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// 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. - /// Update parameters. + /// Update parameters. /// /// Notify change in Subscription State. /// - If false, do not send any email notification for change of state of subscription @@ -521,17 +521,17 @@ public async Task> UpdateAsync(string subscri /// /// Determines the type of application which send the create user request. Default is legacy publisher portal. /// The cancellation token to use. - /// , , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string sid, ETag ifMatch, ApiManagementSubscriptionPatch patch, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string sid, ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); Argument.AssertNotNullOrEmpty(sid, nameof(sid)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(subscriptionUpdateParameters, nameof(subscriptionUpdateParameters)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, sid, ifMatch, patch, notify, appType); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, sid, ifMatch, subscriptionUpdateParameters, notify, appType); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -571,8 +571,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// 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. @@ -599,8 +599,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// 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. @@ -650,8 +650,8 @@ internal HttpMessage CreateRegeneratePrimaryKeyRequest(string subscriptionId, st } /// Regenerates primary key of existing subscription of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -676,8 +676,8 @@ public async Task RegeneratePrimaryKeyAsync(string subscriptionId, str } /// Regenerates primary key of existing subscription of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -725,8 +725,8 @@ internal HttpMessage CreateRegenerateSecondaryKeyRequest(string subscriptionId, } /// Regenerates secondary key of existing subscription of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -751,8 +751,8 @@ public async Task RegenerateSecondaryKeyAsync(string subscriptionId, s } /// Regenerates secondary key of existing subscription of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -800,8 +800,8 @@ internal HttpMessage CreateListSecretsRequest(string subscriptionId, string reso } /// Gets the specified Subscription keys. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -831,8 +831,8 @@ public async Task> ListSecretsAsync(string su } /// Gets the specified Subscription keys. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. @@ -877,8 +877,8 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists all subscriptions of the API Management service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. /// Number of records to return. @@ -911,8 +911,8 @@ public async Task> ListNextPageAsync(string nex /// Lists all subscriptions of the API Management service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagApiLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagApiLinkRestOperations.cs new file mode 100644 index 000000000000..8fbf74b6e2ae --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagApiLinkRestOperations.cs @@ -0,0 +1,505 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class TagApiLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of TagApiLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public TagApiLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/apiLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the API links associated with a tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagApiLinkListResult.DeserializeTagApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the API links associated with a tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagApiLinkListResult.DeserializeTagApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the API link for the tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, tagId, apiLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagApiLinkContractData.DeserializeTagApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagApiLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the API link for the tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, tagId, apiLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagApiLinkContractData.DeserializeTagApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagApiLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId, TagApiLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds an API to the specified tag via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, tagId, apiLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagApiLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagApiLinkContractData.DeserializeTagApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds an API to the specified tag via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, tagId, apiLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagApiLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagApiLinkContractData.DeserializeTagApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified API from the specified tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, tagId, apiLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified API from the specified tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, tagId, apiLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the API links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagApiLinkListResult.DeserializeTagApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the API links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagApiLinkListResult.DeserializeTagApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagOperationLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagOperationLinkRestOperations.cs new file mode 100644 index 000000000000..32f4071abb2f --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagOperationLinkRestOperations.cs @@ -0,0 +1,505 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class TagOperationLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of TagOperationLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public TagOperationLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/operationLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the operation links associated with a tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagOperationLinkListResult.DeserializeTagOperationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the operation links associated with a tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagOperationLinkListResult.DeserializeTagOperationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/operationLinks/", false); + uri.AppendPath(operationLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the operation link for the tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, tagId, operationLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagOperationLinkContractData.DeserializeTagOperationLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagOperationLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the operation link for the tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, tagId, operationLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagOperationLinkContractData.DeserializeTagOperationLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagOperationLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId, TagOperationLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/operationLinks/", false); + uri.AppendPath(operationLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds an operation to the specified tag via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, tagId, operationLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagOperationLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagOperationLinkContractData.DeserializeTagOperationLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds an operation to the specified tag via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, tagId, operationLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagOperationLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagOperationLinkContractData.DeserializeTagOperationLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/operationLinks/", false); + uri.AppendPath(operationLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified operation from the specified tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, tagId, operationLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified operation from the specified tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, tagId, operationLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the operation links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagOperationLinkListResult.DeserializeTagOperationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the operation links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagOperationLinkListResult.DeserializeTagOperationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagProductLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagProductLinkRestOperations.cs new file mode 100644 index 000000000000..0651aadafb21 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagProductLinkRestOperations.cs @@ -0,0 +1,505 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class TagProductLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of TagProductLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public TagProductLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/productLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the product links associated with a tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagProductLinkListResult.DeserializeTagProductLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the product links associated with a tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagProductLinkListResult.DeserializeTagProductLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/productLinks/", false); + uri.AppendPath(productLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the product link for the tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, tagId, productLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagProductLinkContractData.DeserializeTagProductLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagProductLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the product link for the tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, tagId, productLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagProductLinkContractData.DeserializeTagProductLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagProductLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId, TagProductLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/productLinks/", false); + uri.AppendPath(productLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds a product to the specified tag via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, tagId, productLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagProductLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagProductLinkContractData.DeserializeTagProductLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds a product to the specified tag via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, tagId, productLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagProductLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagProductLinkContractData.DeserializeTagProductLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/productLinks/", false); + uri.AppendPath(productLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified product from the specified tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, tagId, productLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified product from the specified tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, tagId, productLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the product links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagProductLinkListResult.DeserializeTagProductLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the product links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagProductLinkListResult.DeserializeTagProductLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagResourceRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagResourceRestOperations.cs index 57fea4d0dce9..381075c4574f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagResourceRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagResourceRestOperations.cs @@ -33,7 +33,7 @@ public TagResourceRestOperations(HttpPipeline pipeline, string applicationId, Ur { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -71,8 +71,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of resources associated with tags. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| aid | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| isCurrent | filter | eq | |</br>. /// Number of records to return. @@ -103,8 +103,8 @@ public async Task> ListByServiceAsync(string sub } /// Lists a collection of resources associated with tags. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| aid | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| isCurrent | filter | eq | |</br>. /// Number of records to return. @@ -150,8 +150,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of resources associated with tags. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| aid | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| isCurrent | filter | eq | |</br>. /// Number of records to return. @@ -184,8 +184,8 @@ public async Task> ListByServiceNextPageAsync(st /// Lists a collection of resources associated with tags. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| aid | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| isCurrent | filter | eq | |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagRestOperations.cs index d0e282f10f6d..be594c76fa92 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TagRestOperations.cs @@ -33,7 +33,7 @@ public TagRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoi { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -75,8 +75,8 @@ internal HttpMessage CreateListByOperationRequest(string subscriptionId, string } /// Lists all Tags associated with the Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -111,8 +111,8 @@ public async Task> ListByOperationAsync(string subscript } /// Lists all Tags associated with the Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -173,8 +173,8 @@ internal HttpMessage CreateGetEntityStateByOperationRequest(string subscriptionI } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -211,8 +211,8 @@ public async Task> GetEntityStateByOperationAsync(string subscrip } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -275,8 +275,8 @@ internal HttpMessage CreateGetByOperationRequest(string subscriptionId, string r } /// Get tag associated with the Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -312,8 +312,8 @@ public async Task> GetByOperationAsync(string subscrip } /// Get tag associated with the Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -375,8 +375,8 @@ internal HttpMessage CreateAssignToOperationRequest(string subscriptionId, strin } /// Assign tag to the Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -411,8 +411,8 @@ public async Task> AssignToOperationAsync(string subsc } /// Assign tag to the Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -473,8 +473,8 @@ internal HttpMessage CreateDetachFromOperationRequest(string subscriptionId, str } /// Detach the tag from the Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -504,8 +504,8 @@ public async Task DetachFromOperationAsync(string subscriptionId, stri } /// Detach the tag from the Operation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -570,8 +570,8 @@ internal HttpMessage CreateListByApiRequest(string subscriptionId, string resour } /// Lists all Tags associated with the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -604,8 +604,8 @@ public async Task> ListByApiAsync(string subscriptionId, } /// Lists all Tags associated with the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -662,8 +662,8 @@ internal HttpMessage CreateGetEntityStateByApiRequest(string subscriptionId, str } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Tag identifier. Must be unique in the current API Management service instance. @@ -698,8 +698,8 @@ public async Task> GetEntityStateByApiAsync(string subscriptionId } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Tag identifier. Must be unique in the current API Management service instance. @@ -758,8 +758,8 @@ internal HttpMessage CreateGetByApiRequest(string subscriptionId, string resourc } /// Get tag associated with the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Tag identifier. Must be unique in the current API Management service instance. @@ -793,8 +793,8 @@ public async Task> GetByApiAsync(string subscriptionId } /// Get tag associated with the API. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Tag identifier. Must be unique in the current API Management service instance. @@ -852,8 +852,8 @@ internal HttpMessage CreateAssignToApiRequest(string subscriptionId, string reso } /// Assign tag to the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Tag identifier. Must be unique in the current API Management service instance. @@ -886,8 +886,8 @@ public async Task> AssignToApiAsync(string subscriptio } /// Assign tag to the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Tag identifier. Must be unique in the current API Management service instance. @@ -944,8 +944,8 @@ internal HttpMessage CreateDetachFromApiRequest(string subscriptionId, string re } /// Detach the tag from the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Tag identifier. Must be unique in the current API Management service instance. @@ -973,8 +973,8 @@ public async Task DetachFromApiAsync(string subscriptionId, string res } /// Detach the tag from the Api. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Tag identifier. Must be unique in the current API Management service instance. @@ -1037,8 +1037,8 @@ internal HttpMessage CreateListByProductRequest(string subscriptionId, string re } /// Lists all Tags associated with the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -1071,8 +1071,8 @@ public async Task> ListByProductAsync(string subscriptio } /// Lists all Tags associated with the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -1129,8 +1129,8 @@ internal HttpMessage CreateGetEntityStateByProductRequest(string subscriptionId, } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Tag identifier. Must be unique in the current API Management service instance. @@ -1165,8 +1165,8 @@ public async Task> GetEntityStateByProductAsync(string subscripti } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Tag identifier. Must be unique in the current API Management service instance. @@ -1225,8 +1225,8 @@ internal HttpMessage CreateGetByProductRequest(string subscriptionId, string res } /// Get tag associated with the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Tag identifier. Must be unique in the current API Management service instance. @@ -1260,8 +1260,8 @@ public async Task> GetByProductAsync(string subscripti } /// Get tag associated with the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Tag identifier. Must be unique in the current API Management service instance. @@ -1319,8 +1319,8 @@ internal HttpMessage CreateAssignToProductRequest(string subscriptionId, string } /// Assign tag to the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Tag identifier. Must be unique in the current API Management service instance. @@ -1353,8 +1353,8 @@ public async Task> AssignToProductAsync(string subscri } /// Assign tag to the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Tag identifier. Must be unique in the current API Management service instance. @@ -1411,8 +1411,8 @@ internal HttpMessage CreateDetachFromProductRequest(string subscriptionId, strin } /// Detach the tag from the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Tag identifier. Must be unique in the current API Management service instance. @@ -1440,8 +1440,8 @@ public async Task DetachFromProductAsync(string subscriptionId, string } /// Detach the tag from the Product. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// Tag identifier. Must be unique in the current API Management service instance. @@ -1506,8 +1506,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of tags defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -1539,8 +1539,8 @@ public async Task> ListByServiceAsync(string subscriptio } /// Lists a collection of tags defined within a service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -1594,8 +1594,8 @@ internal HttpMessage CreateGetEntityStateRequest(string subscriptionId, string r } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -1628,8 +1628,8 @@ public async Task> GetEntityStateAsync(string subscriptionId, str } /// Gets the entity state version of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -1684,8 +1684,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -1717,8 +1717,8 @@ public async Task> GetAsync(string subscriptionId, str } /// Gets the details of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -1780,8 +1780,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a tag. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// Create parameters. @@ -1815,8 +1815,8 @@ public async Task> CreateOrUpdateAsync(string subscrip } /// Creates a tag. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// Create parameters. @@ -1877,8 +1877,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the details of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// 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. @@ -1911,8 +1911,8 @@ public async Task> UpdateAsync(string subscriptionId, } /// Updates the details of the tag specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// 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. @@ -1968,8 +1968,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific tag of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// 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. @@ -1996,8 +1996,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific tag of the API Management service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Tag identifier. Must be unique in the current API Management service instance. /// 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. @@ -2039,8 +2039,8 @@ internal HttpMessage CreateListByOperationNextPageRequest(string nextLink, strin /// Lists all Tags associated with the Operation. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -2077,8 +2077,8 @@ public async Task> ListByOperationNextPageAsync(string n /// Lists all Tags associated with the Operation. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// Operation identifier within an API. Must be unique in the current API Management service instance. @@ -2129,8 +2129,8 @@ internal HttpMessage CreateListByApiNextPageRequest(string nextLink, string subs /// Lists all Tags associated with the API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -2165,8 +2165,8 @@ public async Task> ListByApiNextPageAsync(string nextLin /// Lists all Tags associated with the API. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// 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. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -2215,8 +2215,8 @@ internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string /// Lists all Tags associated with the Product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -2251,8 +2251,8 @@ public async Task> ListByProductNextPageAsync(string nex /// Lists all Tags associated with the Product. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Product identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -2301,8 +2301,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of tags defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. @@ -2336,8 +2336,8 @@ public async Task> ListByServiceNextPageAsync(string nex /// Lists a collection of tags defined within a service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessGitRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessGitRestOperations.cs index 4b9d9b541f04..187de2549d55 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessGitRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessGitRestOperations.cs @@ -32,7 +32,7 @@ public TenantAccessGitRestOperations(HttpPipeline pipeline, string applicationId { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -60,8 +60,8 @@ internal HttpMessage CreateRegeneratePrimaryKeyRequest(string subscriptionId, st } /// Regenerate primary access key for GIT. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -85,8 +85,8 @@ public async Task RegeneratePrimaryKeyAsync(string subscriptionId, str } /// Regenerate primary access key for GIT. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -133,8 +133,8 @@ internal HttpMessage CreateRegenerateSecondaryKeyRequest(string subscriptionId, } /// Regenerate secondary access key for GIT. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -158,8 +158,8 @@ public async Task RegenerateSecondaryKeyAsync(string subscriptionId, s } /// Regenerate secondary access key for GIT. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessRestOperations.cs index 2975ded82549..049c9e149b22 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantAccessRestOperations.cs @@ -33,7 +33,7 @@ public TenantAccessRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -63,8 +63,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Returns list of access infos - for Git and Management endpoints. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Not used. /// The cancellation token to use. @@ -93,8 +93,8 @@ public async Task> ListByServiceAsync(stri } /// Returns list of access infos - for Git and Management endpoints. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Not used. /// The cancellation token to use. @@ -145,8 +145,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Tenant access metadata. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -178,8 +178,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Tenant access metadata. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -233,8 +233,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get tenant access information details without secrets. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -265,8 +265,8 @@ public async Task> GetAsync(string subscriptionId } /// Get tenant access information details without secrets. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -324,8 +324,8 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG } /// Update tenant access information details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// 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. @@ -357,8 +357,8 @@ public async Task> CreateAsync(string subscriptio } /// Update tenant access information details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// 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. @@ -417,8 +417,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Update tenant access information details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// 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. @@ -450,8 +450,8 @@ public async Task> UpdateAsync(string subscriptio } /// Update tenant access information details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// 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. @@ -506,8 +506,8 @@ internal HttpMessage CreateRegeneratePrimaryKeyRequest(string subscriptionId, st } /// Regenerate primary access key. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -531,8 +531,8 @@ public async Task RegeneratePrimaryKeyAsync(string subscriptionId, str } /// Regenerate primary access key. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -579,8 +579,8 @@ internal HttpMessage CreateRegenerateSecondaryKeyRequest(string subscriptionId, } /// Regenerate secondary access key. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -604,8 +604,8 @@ public async Task RegenerateSecondaryKeyAsync(string subscriptionId, s } /// Regenerate secondary access key. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -652,8 +652,8 @@ internal HttpMessage CreateListSecretsRequest(string subscriptionId, string reso } /// Get tenant access information details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -682,8 +682,8 @@ public async Task> ListSecretsAsync(str } /// Get tenant access information details. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Access configuration. /// The cancellation token to use. @@ -727,8 +727,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Returns list of access infos - for Git and Management endpoints. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Not used. /// The cancellation token to use. @@ -759,8 +759,8 @@ public async Task> ListByServiceNextPageAs /// Returns list of access infos - for Git and Management endpoints. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Not used. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantConfigurationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantConfigurationRestOperations.cs index c6efc569762b..30e70e5c8bec 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantConfigurationRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantConfigurationRestOperations.cs @@ -33,7 +33,7 @@ public TenantConfigurationRestOperations(HttpPipeline pipeline, string applicati { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -65,8 +65,8 @@ internal HttpMessage CreateDeployRequest(string subscriptionId, string resourceG } /// This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Git Configuration Operation. /// Deploy Configuration parameters. @@ -93,8 +93,8 @@ public async Task DeployAsync(string subscriptionId, string resourceGr } /// This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Git Configuration Operation. /// Deploy Configuration parameters. @@ -148,8 +148,8 @@ internal HttpMessage CreateSaveRequest(string subscriptionId, string resourceGro } /// This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Git Configuration Operation. /// Save Configuration parameters. @@ -176,8 +176,8 @@ public async Task SaveAsync(string subscriptionId, string resourceGrou } /// This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Git Configuration Operation. /// Save Configuration parameters. @@ -231,8 +231,8 @@ internal HttpMessage CreateValidateRequest(string subscriptionId, string resourc } /// This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Git Configuration Operation. /// Validate Configuration parameters. @@ -259,8 +259,8 @@ public async Task ValidateAsync(string subscriptionId, string resource } /// This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Git Configuration Operation. /// Validate Configuration parameters. @@ -310,8 +310,8 @@ internal HttpMessage CreateGetSyncStateRequest(string subscriptionId, string res } /// Gets the status of the most recent synchronization between the configuration database and the Git repository. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Git Configuration Operation. /// The cancellation token to use. @@ -340,8 +340,8 @@ public async Task> GetSyncStateAs } /// Gets the status of the most recent synchronization between the configuration database and the Git repository. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the Git Configuration Operation. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantSettingsRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantSettingsRestOperations.cs index 716f1a88f70d..25e33da460e7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantSettingsRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/TenantSettingsRestOperations.cs @@ -33,7 +33,7 @@ public TenantSettingsRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -63,8 +63,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Public settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Not used. /// The cancellation token to use. @@ -93,8 +93,8 @@ public async Task> ListByServiceAsync(string } /// Public settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Not used. /// The cancellation token to use. @@ -145,8 +145,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Get tenant settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the settings. /// The cancellation token to use. @@ -177,8 +177,8 @@ public async Task> GetAsync(string subs } /// Get tenant settings. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// The identifier of the settings. /// The cancellation token to use. @@ -224,8 +224,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Public settings. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Not used. /// The cancellation token to use. @@ -256,8 +256,8 @@ public async Task> ListByServiceNextPageAsync /// Public settings. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// Not used. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserConfirmationPasswordRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserConfirmationPasswordRestOperations.cs index 4f06d21ceedb..03ef1b8b6e64 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserConfirmationPasswordRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserConfirmationPasswordRestOperations.cs @@ -32,7 +32,7 @@ public UserConfirmationPasswordRestOperations(HttpPipeline pipeline, string appl { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -64,8 +64,8 @@ internal HttpMessage CreateSendRequest(string subscriptionId, string resourceGro } /// Sends confirmation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// Determines the type of application which send the create user request. Default is legacy publisher portal. @@ -91,8 +91,8 @@ public async Task SendAsync(string subscriptionId, string resourceGrou } /// Sends confirmation. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// Determines the type of application which send the create user request. Default is legacy publisher portal. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserGroupRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserGroupRestOperations.cs index 5ac160d40908..8eca5d1cf68c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserGroupRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserGroupRestOperations.cs @@ -33,7 +33,7 @@ public UserGroupRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// Lists all user groups. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|------------------------|-----------------------------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListAsync(string subscriptionId, st } /// Lists all user groups. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|------------------------|-----------------------------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -156,8 +156,8 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists all user groups. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|------------------------|-----------------------------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -192,8 +192,8 @@ public async Task> ListNextPageAsync(string nextLink, /// Lists all user groups. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|------------------------|-----------------------------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserIdentitiesRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserIdentitiesRestOperations.cs index 5aa72d7280fe..756edc4e25d0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserIdentitiesRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserIdentitiesRestOperations.cs @@ -33,7 +33,7 @@ public UserIdentitiesRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -61,8 +61,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// List of all user identities. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -92,8 +92,8 @@ public async Task> ListAsync(string subscriptio } /// List of all user identities. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -138,8 +138,8 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// List of all user identities. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -171,8 +171,8 @@ public async Task> ListNextPageAsync(string nex /// List of all user identities. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserRestOperations.cs index 00f75796cfba..283735acd188 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserRestOperations.cs @@ -33,7 +33,7 @@ public UserRestOperations(HttpPipeline pipeline, string applicationId, Uri endpo { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -75,8 +75,8 @@ internal HttpMessage CreateListByServiceRequest(string subscriptionId, string re } /// Lists a collection of registered users in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| groups | expand | | |</br>. /// Number of records to return. @@ -108,8 +108,8 @@ public async Task> ListByServiceAsync(string subscripti } /// Lists a collection of registered users in the specified service instance. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| groups | expand | | |</br>. /// Number of records to return. @@ -163,8 +163,8 @@ internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string res } /// Gets the entity state (Etag) version of the user specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -197,8 +197,8 @@ public async Task> GetEntityTagAsync(string subscriptionId, strin } /// Gets the entity state (Etag) version of the user specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -253,8 +253,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the details of the user specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -286,8 +286,8 @@ public async Task> GetAsync(string subscriptionId, st } /// Gets the details of the user specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -353,8 +353,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or Updates a user. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// Create or update parameters. @@ -389,8 +389,8 @@ public async Task> CreateOrUpdateAsync(string subscri } /// Creates or Updates a user. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// Create or update parameters. @@ -452,8 +452,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates the details of the user specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// 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. @@ -486,8 +486,8 @@ public async Task> UpdateAsync(string subscriptionId, } /// Updates the details of the user specified by its identifier. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// 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. @@ -555,8 +555,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes specific user. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// 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. @@ -586,8 +586,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes specific user. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// 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. @@ -640,8 +640,8 @@ internal HttpMessage CreateGenerateSsoUriRequest(string subscriptionId, string r } /// Retrieves a redirection URL containing an authentication token for signing a given user into the developer portal. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -671,8 +671,8 @@ public async Task> GenerateSsoUriAsync(string sub } /// Retrieves a redirection URL containing an authentication token for signing a given user into the developer portal. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. @@ -729,8 +729,8 @@ internal HttpMessage CreateGetSharedAccessTokenRequest(string subscriptionId, st } /// Gets the Shared Access Authorization Token for the User. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// Create Authorization Token parameters. @@ -762,8 +762,8 @@ public async Task> GetSharedAccessTokenAsync(string su } /// Gets the Shared Access Authorization Token for the User. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// Create Authorization Token parameters. @@ -810,8 +810,8 @@ internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string /// Lists a collection of registered users in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| groups | expand | | |</br>. /// Number of records to return. @@ -845,8 +845,8 @@ public async Task> ListByServiceNextPageAsync(string ne /// Lists a collection of registered users in the specified service instance. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| groups | expand | | |</br>. /// Number of records to return. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserSubscriptionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserSubscriptionRestOperations.cs index d8a7946a3c63..943f3f481be8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserSubscriptionRestOperations.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/UserSubscriptionRestOperations.cs @@ -33,7 +33,7 @@ public UserSubscriptionRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-08-01"; + _apiVersion = apiVersion ?? "2022-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,8 +73,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// Lists the collection of subscriptions of the specified user. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|------------------------|-----------------------------------|</br>|name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -107,8 +107,8 @@ public async Task> ListAsync(string subscriptio } /// Lists the collection of subscriptions of the specified user. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|------------------------|-----------------------------------|</br>|name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -165,8 +165,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the specified Subscription entity associated with a particular user. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. @@ -200,8 +200,8 @@ public async Task> GetAsync(string subscripti } /// Gets the specified Subscription entity associated with a particular user. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. @@ -250,8 +250,8 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists the collection of subscriptions of the specified user. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|------------------------|-----------------------------------|</br>|name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. @@ -286,8 +286,8 @@ public async Task> ListNextPageAsync(string nex /// Lists the collection of subscriptions of the specified user. /// The URL to the next page of results. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the API Management service. /// User identifier. Must be unique in the current API Management service instance. /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|------------------------|-----------------------------------|</br>|name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>|productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiOperationPolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiOperationPolicyRestOperations.cs new file mode 100644 index 000000000000..484c2f110b13 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiOperationPolicyRestOperations.cs @@ -0,0 +1,564 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceApiOperationPolicyRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceApiOperationPolicyRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceApiOperationPolicyRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByOperationRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendPath("/policies", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the list of policy configuration at the API Operation level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByOperationAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateListByOperationRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the list of policy configuration at the API Operation level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response ListByOperation(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateListByOperationRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the API operation policy specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the API operation policy specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, PolicyExportFormat? format) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + if (format != null) + { + uri.AppendQuery("format", format.Value.ToString(), true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy configuration at the API Operation level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId, format); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy configuration at the API Operation level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId, format); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, PolicyContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates policy configuration for the API Operation level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates policy configuration for the API Operation level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the policy configuration at the Api Operation. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// 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. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the policy configuration at the Api Operation. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// 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. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, policyId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiOperationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiOperationRestOperations.cs new file mode 100644 index 000000000000..cb4b2c1daa7f --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiOperationRestOperations.cs @@ -0,0 +1,759 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceApiOperationRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceApiOperationRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceApiOperationRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByApiRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter, int? top, int? skip, string tags) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + if (tags != null) + { + uri.AppendQuery("tags", tags, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the operations for the specified API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApiAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip, tags); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the operations for the specified API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByApi(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip, tags); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the API operation specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the API operation specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the API Operation specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiOperationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiOperationData.DeserializeApiOperationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiOperationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the API Operation specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiOperationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiOperationData.DeserializeApiOperationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiOperationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, ApiOperationData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates a new operation in the API or updates an existing one. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, ApiOperationData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiOperationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiOperationData.DeserializeApiOperationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a new operation in the API or updates an existing one. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, ApiOperationData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiOperationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiOperationData.DeserializeApiOperationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, ETag ifMatch, OperationUpdateContract operationUpdateContract) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(operationUpdateContract); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the operation in the API specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// 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. + /// API Operation Update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, ETag ifMatch, OperationUpdateContract operationUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + Argument.AssertNotNull(operationUpdateContract, nameof(operationUpdateContract)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, ifMatch, operationUpdateContract); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiOperationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiOperationData.DeserializeApiOperationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the operation in the API specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// 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. + /// API Operation Update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, ETag ifMatch, OperationUpdateContract operationUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + Argument.AssertNotNull(operationUpdateContract, nameof(operationUpdateContract)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, ifMatch, operationUpdateContract); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiOperationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiOperationData.DeserializeApiOperationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified operation in the API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified operation in the API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, operationId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByApiNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter, int? top, int? skip, string tags) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the operations for the specified API. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApiNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip, tags); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the operations for the specified API. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByApiNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip, tags); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiPolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiPolicyRestOperations.cs new file mode 100644 index 000000000000..791dfe3e0329 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiPolicyRestOperations.cs @@ -0,0 +1,534 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceApiPolicyRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceApiPolicyRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceApiPolicyRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByApiRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/policies", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy configuration at the API level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApiAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy configuration at the API level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByApi(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the API policy specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the API policy specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, PolicyExportFormat? format) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + if (format != null) + { + uri.AppendQuery("format", format.Value.ToString(), true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json, application/vnd.ms-azure-apim.policy+xml, application/vnd.ms-azure-apim.policy.raw+xml"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy configuration at the API level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId, format); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy configuration at the API level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId, format); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, PolicyContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates policy configuration for the API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates policy configuration for the API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the policy configuration at the Api. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// The identifier of the Policy. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the policy configuration at the Api. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// The identifier of the Policy. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, policyId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiReleaseRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiReleaseRestOperations.cs new file mode 100644 index 000000000000..1d3e50163796 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiReleaseRestOperations.cs @@ -0,0 +1,751 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceApiReleaseRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceApiReleaseRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceApiReleaseRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/releases", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// 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. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiReleaseListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiReleaseListResult.DeserializeApiReleaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// 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. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiReleaseListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiReleaseListResult.DeserializeApiReleaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/releases/", false); + uri.AppendPath(releaseId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Returns the etag of an API release. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns the etag of an API release. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/releases/", false); + uri.AppendPath(releaseId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Returns the details of an API release. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiReleaseData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiReleaseData.DeserializeApiReleaseData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiReleaseData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns the details of an API release. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiReleaseData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiReleaseData.DeserializeApiReleaseData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiReleaseData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, ApiReleaseData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/releases/", false); + uri.AppendPath(releaseId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates a new Release for the API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, ApiReleaseData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiReleaseData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiReleaseData.DeserializeApiReleaseData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a new Release for the API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, ApiReleaseData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiReleaseData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiReleaseData.DeserializeApiReleaseData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, ETag ifMatch, ApiReleaseData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/releases/", false); + uri.AppendPath(releaseId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the release of the API specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// 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. + /// API Release Update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, ETag ifMatch, ApiReleaseData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId, ifMatch, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiReleaseData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiReleaseData.DeserializeApiReleaseData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the release of the API specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// 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. + /// API Release Update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, ETag ifMatch, ApiReleaseData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId, ifMatch, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiReleaseData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiReleaseData.DeserializeApiReleaseData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/releases/", false); + uri.AppendPath(releaseId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified release in the API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified release in the API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, releaseId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// 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. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiReleaseListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiReleaseListResult.DeserializeApiReleaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// 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. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiReleaseListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiReleaseListResult.DeserializeApiReleaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiRestOperations.cs new file mode 100644 index 000000000000..f86fd6be4d1d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiRestOperations.cs @@ -0,0 +1,725 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceApiRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceApiRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceApiRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip, string tags, bool? expandApiVersionSet) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + if (tags != null) + { + uri.AppendQuery("tags", tags, true); + } + if (expandApiVersionSet != null) + { + uri.AppendQuery("expandApiVersionSet", expandApiVersionSet.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all APIs of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// Include full ApiVersionSet resource in response. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, tags, expandApiVersionSet); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiListResult.DeserializeApiListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all APIs of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// Include full ApiVersionSet resource in response. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, tags, expandApiVersionSet); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiListResult.DeserializeApiListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the API specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the API specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the API specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiData.DeserializeApiData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the API specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiData.DeserializeApiData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(apiCreateOrUpdateParameter); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates new or updates existing specified API of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(apiCreateOrUpdateParameter, nameof(apiCreateOrUpdateParameter)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, apiCreateOrUpdateParameter, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates new or updates existing specified API of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(apiCreateOrUpdateParameter, nameof(apiCreateOrUpdateParameter)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, apiCreateOrUpdateParameter, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, ETag ifMatch, ApiUpdateContract apiUpdateContract) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(apiUpdateContract); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the specified API of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// 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. + /// API Update Contract parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, ETag ifMatch, ApiUpdateContract apiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(apiUpdateContract, nameof(apiUpdateContract)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, ifMatch, apiUpdateContract); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiData.DeserializeApiData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the specified API of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// 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. + /// API Update Contract parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, ETag ifMatch, ApiUpdateContract apiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(apiUpdateContract, nameof(apiUpdateContract)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, ifMatch, apiUpdateContract); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiData.DeserializeApiData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, ETag ifMatch, bool? deleteRevisions) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + if (deleteRevisions != null) + { + uri.AppendQuery("deleteRevisions", deleteRevisions.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified API of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// 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. + /// Delete all revisions of the Api. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, ETag ifMatch, bool? deleteRevisions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, ifMatch, deleteRevisions); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified API of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// 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. + /// Delete all revisions of the Api. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, ETag ifMatch, bool? deleteRevisions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, ifMatch, deleteRevisions); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip, string tags, bool? expandApiVersionSet) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all APIs of the workspace in an API Management service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// Include full ApiVersionSet resource in response. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, tags, expandApiVersionSet); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiListResult.DeserializeApiListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all APIs of the workspace in an API Management service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// Include full ApiVersionSet resource in response. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, tags, expandApiVersionSet); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiListResult.DeserializeApiListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiRevisionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiRevisionRestOperations.cs new file mode 100644 index 000000000000..661eab8e7955 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiRevisionRestOperations.cs @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceApiRevisionRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceApiRevisionRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceApiRevisionRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/revisions", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all revisions of an API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiRevisionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiRevisionListResult.DeserializeApiRevisionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all revisions of an API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiRevisionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiRevisionListResult.DeserializeApiRevisionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all revisions of an API. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiRevisionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiRevisionListResult.DeserializeApiRevisionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all revisions of an API. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// API identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiRevisionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiRevisionListResult.DeserializeApiRevisionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiSchemaRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiSchemaRestOperations.cs new file mode 100644 index 000000000000..4ed1df297871 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiSchemaRestOperations.cs @@ -0,0 +1,642 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceApiSchemaRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceApiSchemaRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceApiSchemaRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByApiRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/schemas", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the schema configuration at the API level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApiAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SchemaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SchemaListResult.DeserializeSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the schema configuration at the API level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByApi(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SchemaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SchemaListResult.DeserializeSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the schema specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the schema specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the schema configuration at the API level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiSchemaData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiSchemaData.DeserializeApiSchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiSchemaData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the schema configuration at the API level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiSchemaData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiSchemaData.DeserializeApiSchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiSchemaData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, ApiSchemaData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates schema configuration for the API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The schema contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates schema configuration for the API. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The schema contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, ETag ifMatch, bool? force) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apis/", false); + uri.AppendPath(apiId, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaId, true); + if (force != null) + { + uri.AppendQuery("force", force.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the schema configuration at the Api. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// 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. + /// If true removes all references to the schema before deleting it. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, ETag ifMatch, bool? force = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId, ifMatch, force); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the schema configuration at the Api. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// 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. + /// If true removes all references to the schema before deleting it. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId, ETag ifMatch, bool? force = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, schemaId, ifMatch, force); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByApiNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the schema configuration at the API level. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApiNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SchemaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SchemaListResult.DeserializeSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the schema configuration at the API level. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByApiNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var message = CreateListByApiNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, apiId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SchemaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SchemaListResult.DeserializeSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiVersionSetRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiVersionSetRestOperations.cs new file mode 100644 index 000000000000..75b196497ebb --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceApiVersionSetRestOperations.cs @@ -0,0 +1,711 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceApiVersionSetRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceApiVersionSetRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceApiVersionSetRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apiVersionSets", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of API Version Sets in the specified workspace with a service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiVersionSetListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiVersionSetListResult.DeserializeApiVersionSetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of API Version Sets in the specified workspace with a service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiVersionSetListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiVersionSetListResult.DeserializeApiVersionSetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apiVersionSets/", false); + uri.AppendPath(versionSetId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the Api Version Set specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the Api Version Set specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apiVersionSets/", false); + uri.AppendPath(versionSetId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the Api Version Set specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiVersionSetData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiVersionSetData.DeserializeApiVersionSetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiVersionSetData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the Api Version Set specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiVersionSetData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiVersionSetData.DeserializeApiVersionSetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiVersionSetData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, ApiVersionSetData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apiVersionSets/", false); + uri.AppendPath(versionSetId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or Updates a Api Version Set. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, ApiVersionSetData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiVersionSetData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiVersionSetData.DeserializeApiVersionSetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or Updates a Api Version Set. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, ApiVersionSetData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiVersionSetData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiVersionSetData.DeserializeApiVersionSetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apiVersionSets/", false); + uri.AppendPath(versionSetId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(apiVersionSetUpdateParameters); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the Api VersionSet specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + Argument.AssertNotNull(apiVersionSetUpdateParameters, nameof(apiVersionSetUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId, ifMatch, apiVersionSetUpdateParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiVersionSetData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiVersionSetData.DeserializeApiVersionSetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the Api VersionSet specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + Argument.AssertNotNull(apiVersionSetUpdateParameters, nameof(apiVersionSetUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId, ifMatch, apiVersionSetUpdateParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiVersionSetData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiVersionSetData.DeserializeApiVersionSetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/apiVersionSets/", false); + uri.AppendPath(versionSetId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes specific Api Version Set. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes specific Api Version Set. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, versionSetId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of API Version Sets in the specified workspace with a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiVersionSetListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiVersionSetListResult.DeserializeApiVersionSetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of API Version Sets in the specified workspace with a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiVersionSetListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiVersionSetListResult.DeserializeApiVersionSetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceGlobalSchemaRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceGlobalSchemaRestOperations.cs new file mode 100644 index 000000000000..830d719e9946 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceGlobalSchemaRestOperations.cs @@ -0,0 +1,602 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceGlobalSchemaRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceGlobalSchemaRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceGlobalSchemaRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/schemas", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of schemas registered with workspace in a service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GlobalSchemaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GlobalSchemaListResult.DeserializeGlobalSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of schemas registered with workspace in a service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GlobalSchemaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GlobalSchemaListResult.DeserializeGlobalSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the Schema specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the Schema specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the Schema specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiManagementGlobalSchemaData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementGlobalSchemaData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the Schema specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiManagementGlobalSchemaData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementGlobalSchemaData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, ApiManagementGlobalSchemaData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates new or updates existing specified Schema of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates new or updates existing specified Schema of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes specific Schema. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes specific Schema. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, schemaId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of schemas registered with workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GlobalSchemaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GlobalSchemaListResult.DeserializeGlobalSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of schemas registered with workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GlobalSchemaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GlobalSchemaListResult.DeserializeGlobalSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceGroupRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceGroupRestOperations.cs new file mode 100644 index 000000000000..5f58b8f4f1c8 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceGroupRestOperations.cs @@ -0,0 +1,711 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceGroupRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceGroupRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceGroupRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of groups defined within a workspace in a service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupListResult.DeserializeGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of groups defined within a workspace in a service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupListResult.DeserializeGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(groupId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the group specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the group specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(groupId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the group specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiManagementGroupData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementGroupData.DeserializeApiManagementGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementGroupData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the group specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiManagementGroupData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementGroupData.DeserializeApiManagementGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementGroupData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(groupId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(groupCreateParameters); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or Updates a group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNull(groupCreateParameters, nameof(groupCreateParameters)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, groupCreateParameters, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiManagementGroupData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementGroupData.DeserializeApiManagementGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or Updates a group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNull(groupCreateParameters, nameof(groupCreateParameters)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, groupCreateParameters, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiManagementGroupData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementGroupData.DeserializeApiManagementGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, ETag ifMatch, GroupUpdateParameters groupUpdateParameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(groupId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(groupUpdateParameters); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the group specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, ETag ifMatch, GroupUpdateParameters groupUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNull(groupUpdateParameters, nameof(groupUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, ifMatch, groupUpdateParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiManagementGroupData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementGroupData.DeserializeApiManagementGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the group specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, ETag ifMatch, GroupUpdateParameters groupUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNull(groupUpdateParameters, nameof(groupUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, ifMatch, groupUpdateParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiManagementGroupData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementGroupData.DeserializeApiManagementGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(groupId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes specific group of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes specific group of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of groups defined within a workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GroupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GroupListResult.DeserializeGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of groups defined within a workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GroupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GroupListResult.DeserializeGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceGroupUserRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceGroupUserRestOperations.cs new file mode 100644 index 000000000000..48d6a09f64dd --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceGroupUserRestOperations.cs @@ -0,0 +1,527 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceGroupUserRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceGroupUserRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceGroupUserRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/users", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of user entities associated with the group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + UserListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = UserListResult.DeserializeUserListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of user entities associated with the group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + UserListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = UserListResult.DeserializeUserListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCheckEntityExistsRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string userId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Checks that user entity specified by identifier is associated with the group entity. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CheckEntityExistsAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateCheckEntityExistsRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, userId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Checks that user entity specified by identifier is associated with the group entity. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CheckEntityExists(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateCheckEntityExistsRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, userId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string userId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Add existing user to existing group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, userId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + UserContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = UserContractData.DeserializeUserContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Add existing user to existing group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, userId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + UserContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = UserContractData.DeserializeUserContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string userId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Remove existing user from existing group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, userId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Remove existing user from existing group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, userId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of user entities associated with the group. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + UserListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = UserListResult.DeserializeUserListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of user entities associated with the group. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Group identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, groupId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + UserListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = UserListResult.DeserializeUserListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNamedValueRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNamedValueRestOperations.cs new file mode 100644 index 000000000000..55be192582ef --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNamedValueRestOperations.cs @@ -0,0 +1,877 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceNamedValueRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceNamedValueRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceNamedValueRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip, bool? isKeyVaultRefreshFailed) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/namedValues", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + if (isKeyVaultRefreshFailed != null) + { + uri.AppendQuery("isKeyVaultRefreshFailed", isKeyVaultRefreshFailed.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of named values defined within a workspace in a service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// When set to true, the response contains only named value entities which failed refresh. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, bool? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, isKeyVaultRefreshFailed); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NamedValueListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NamedValueListResult.DeserializeNamedValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of named values defined within a workspace in a service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// When set to true, the response contains only named value entities which failed refresh. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, bool? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, isKeyVaultRefreshFailed); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NamedValueListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NamedValueListResult.DeserializeNamedValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/namedValues/", false); + uri.AppendPath(namedValueId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the named value specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the named value specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/namedValues/", false); + uri.AppendPath(namedValueId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the named value specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiManagementNamedValueData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementNamedValueData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the named value specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiManagementNamedValueData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementNamedValueData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/namedValues/", false); + uri.AppendPath(namedValueId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(namedValueCreateContract); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates named value. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + Argument.AssertNotNull(namedValueCreateContract, nameof(namedValueCreateContract)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId, namedValueCreateContract, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates named value. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + Argument.AssertNotNull(namedValueCreateContract, nameof(namedValueCreateContract)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId, namedValueCreateContract, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/namedValues/", false); + uri.AppendPath(namedValueId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(namedValueUpdateParameters); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the specific named value. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + Argument.AssertNotNull(namedValueUpdateParameters, nameof(namedValueUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId, ifMatch, namedValueUpdateParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the specific named value. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + Argument.AssertNotNull(namedValueUpdateParameters, nameof(namedValueUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId, ifMatch, namedValueUpdateParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/namedValues/", false); + uri.AppendPath(namedValueId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes specific named value from the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes specific named value from the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListValueRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/namedValues/", false); + uri.AppendPath(namedValueId, true); + uri.AppendPath("/listValue", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the secret of the named value specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListValueAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateListValueRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NamedValueSecretContract value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NamedValueSecretContract.DeserializeNamedValueSecretContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the secret of the named value specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListValue(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateListValueRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NamedValueSecretContract value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NamedValueSecretContract.DeserializeNamedValueSecretContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateRefreshSecretRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/namedValues/", false); + uri.AppendPath(namedValueId, true); + uri.AppendPath("/refreshSecret", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Refresh the secret of the named value specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task RefreshSecretAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateRefreshSecretRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Refresh the secret of the named value specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response RefreshSecret(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var message = CreateRefreshSecretRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, namedValueId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip, bool? isKeyVaultRefreshFailed) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of named values defined within a workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// When set to true, the response contains only named value entities which failed refresh. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, bool? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, isKeyVaultRefreshFailed); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NamedValueListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NamedValueListResult.DeserializeNamedValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of named values defined within a workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// When set to true, the response contains only named value entities which failed refresh. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, bool? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, isKeyVaultRefreshFailed); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NamedValueListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NamedValueListResult.DeserializeNamedValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNotificationRecipientEmailRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNotificationRecipientEmailRestOperations.cs new file mode 100644 index 000000000000..e4f7b1fbf913 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNotificationRecipientEmailRestOperations.cs @@ -0,0 +1,411 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceNotificationRecipientEmailRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceNotificationRecipientEmailRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceNotificationRecipientEmailRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByNotificationRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendPath("/recipientEmails", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of the Notification Recipient Emails subscribed to a notification. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByNotificationAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByNotificationRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RecipientEmailListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RecipientEmailListResult.DeserializeRecipientEmailListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of the Notification Recipient Emails subscribed to a notification. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByNotification(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByNotificationRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RecipientEmailListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RecipientEmailListResult.DeserializeRecipientEmailListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCheckEntityExistsRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string email) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendPath("/recipientEmails/", false); + uri.AppendPath(email, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Determine if Notification Recipient Email subscribed to the notification. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// Email identifier. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CheckEntityExistsAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var message = CreateCheckEntityExistsRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, email); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Determine if Notification Recipient Email subscribed to the notification. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// Email identifier. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CheckEntityExists(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var message = CreateCheckEntityExistsRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, email); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string email) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendPath("/recipientEmails/", false); + uri.AppendPath(email, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Adds the Email address to the list of Recipients for the Notification. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// Email identifier. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, email); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + RecipientEmailContract value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RecipientEmailContract.DeserializeRecipientEmailContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds the Email address to the list of Recipients for the Notification. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// Email identifier. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, email); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + RecipientEmailContract value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RecipientEmailContract.DeserializeRecipientEmailContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string email) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendPath("/recipientEmails/", false); + uri.AppendPath(email, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Removes the email from the list of Notification. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// Email identifier. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, email); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Removes the email from the list of Notification. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// Email identifier. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, email); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNotificationRecipientUserRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNotificationRecipientUserRestOperations.cs new file mode 100644 index 000000000000..b461ffd19799 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNotificationRecipientUserRestOperations.cs @@ -0,0 +1,411 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceNotificationRecipientUserRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceNotificationRecipientUserRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceNotificationRecipientUserRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByNotificationRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendPath("/recipientUsers", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of the Notification Recipient User subscribed to the notification. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByNotificationAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByNotificationRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RecipientUserListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RecipientUserListResult.DeserializeRecipientUserListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of the Notification Recipient User subscribed to the notification. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByNotification(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByNotificationRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RecipientUserListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RecipientUserListResult.DeserializeRecipientUserListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCheckEntityExistsRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string userId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendPath("/recipientUsers/", false); + uri.AppendPath(userId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Determine if the Notification Recipient User is subscribed to the notification. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CheckEntityExistsAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateCheckEntityExistsRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, userId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Determine if the Notification Recipient User is subscribed to the notification. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CheckEntityExists(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateCheckEntityExistsRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, userId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string userId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendPath("/recipientUsers/", false); + uri.AppendPath(userId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Adds the API Management User to the list of Recipients for the Notification. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, userId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + RecipientUserContract value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RecipientUserContract.DeserializeRecipientUserContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds the API Management User to the list of Recipients for the Notification. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, userId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + RecipientUserContract value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RecipientUserContract.DeserializeRecipientUserContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string userId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendPath("/recipientUsers/", false); + uri.AppendPath(userId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Removes the API Management user from the list of Notification. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, userId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Removes the API Management user from the list of Notification. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, userId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNotificationRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNotificationRestOperations.cs new file mode 100644 index 000000000000..d21c2eb5c2e0 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceNotificationRestOperations.cs @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceNotificationRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceNotificationRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceNotificationRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications", false); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of properties defined within a service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NotificationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NotificationListResult.DeserializeNotificationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of properties defined within a service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NotificationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NotificationListResult.DeserializeNotificationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the Notification specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiManagementNotificationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementNotificationData.DeserializeApiManagementNotificationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementNotificationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the Notification specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiManagementNotificationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementNotificationData.DeserializeApiManagementNotificationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementNotificationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/notifications/", false); + uri.AppendPath(notificationName.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Create or Update API Management publisher notification for the workspace. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiManagementNotificationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementNotificationData.DeserializeApiManagementNotificationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or Update API Management publisher notification for the workspace. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Notification Name Identifier. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, notificationName, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiManagementNotificationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementNotificationData.DeserializeApiManagementNotificationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of properties defined within a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NotificationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NotificationListResult.DeserializeNotificationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of properties defined within a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NotificationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NotificationListResult.DeserializeNotificationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspacePolicyFragmentRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspacePolicyFragmentRestOperations.cs new file mode 100644 index 000000000000..a900832245f0 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspacePolicyFragmentRestOperations.cs @@ -0,0 +1,631 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspacePolicyFragmentRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspacePolicyFragmentRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspacePolicyFragmentRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, string orderBy, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policyFragments", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (orderBy != null) + { + uri.AppendQuery("$orderby", orderBy, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets all policy fragments defined within a workspace. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, orderBy, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyFragmentListResult.DeserializePolicyFragmentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all policy fragments defined within a workspace. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, orderBy, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyFragmentListResult.DeserializePolicyFragmentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of a policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of a policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, PolicyFragmentContentFormat? format) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (format != null) + { + uri.AppendQuery("format", format.Value.ToString(), true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id, format); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyFragmentContractData.DeserializePolicyFragmentContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyFragmentContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id, format); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyFragmentContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyFragmentContractData.DeserializePolicyFragmentContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyFragmentContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, PolicyFragmentContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates a policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListReferencesRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policyFragments/", false); + uri.AppendPath(id, true); + uri.AppendPath("/listReferences", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists policy resources that reference the policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListReferencesAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateListReferencesRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResourceListResult.DeserializeResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists policy resources that reference the policy fragment. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// A resource identifier. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListReferences(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var message = CreateListReferencesRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, id, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResourceListResult.DeserializeResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspacePolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspacePolicyRestOperations.cs new file mode 100644 index 000000000000..136de4834dea --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspacePolicyRestOperations.cs @@ -0,0 +1,504 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspacePolicyRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspacePolicyRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspacePolicyRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByApiRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policies", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy configuration at the workspace level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApiAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, workspaceId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy configuration at the workspace level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByApi(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByApiRequest(subscriptionId, resourceGroupName, serviceName, workspaceId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the workspace policy specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the workspace policy specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, PolicyExportFormat? format) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + if (format != null) + { + uri.AppendQuery("format", format.Value.ToString(), true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json, application/vnd.ms-azure-apim.policy+xml, application/vnd.ms-azure-apim.policy.raw+xml"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy configuration at the API level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId, format); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy configuration at the API level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId, format); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, PolicyContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates policy configuration for the workspace. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates policy configuration for the workspace. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the policy configuration at the workspace. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// 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. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the policy configuration at the workspace. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// 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. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, policyId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductApiLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductApiLinkRestOperations.cs new file mode 100644 index 000000000000..fbc7159f60b3 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductApiLinkRestOperations.cs @@ -0,0 +1,533 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceProductApiLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceProductApiLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceProductApiLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/apiLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the API links associated with a product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductApiLinkListResult.DeserializeProductApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the API links associated with a product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductApiLinkListResult.DeserializeProductApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the API link for the product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, apiLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductApiLinkContractData.DeserializeProductApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ProductApiLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the API link for the product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, apiLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductApiLinkContractData.DeserializeProductApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ProductApiLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId, ProductApiLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds an API to the specified product via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, apiLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ProductApiLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductApiLinkContractData.DeserializeProductApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds an API to the specified product via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, apiLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ProductApiLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductApiLinkContractData.DeserializeProductApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified API from the specified product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, apiLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified API from the specified product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, apiLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the API links associated with a product. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, productId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductApiLinkListResult.DeserializeProductApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the API links associated with a product. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, productId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductApiLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductApiLinkListResult.DeserializeProductApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductGroupLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductGroupLinkRestOperations.cs new file mode 100644 index 000000000000..28e49a6178f9 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductGroupLinkRestOperations.cs @@ -0,0 +1,533 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceProductGroupLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceProductGroupLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceProductGroupLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/groupLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the group links associated with a product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductGroupLinkListResult.DeserializeProductGroupLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the group links associated with a product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductGroupLinkListResult.DeserializeProductGroupLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/groupLinks/", false); + uri.AppendPath(groupLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the group link for the product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, groupLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ProductGroupLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the group link for the product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, groupLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ProductGroupLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId, ProductGroupLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/groupLinks/", false); + uri.AppendPath(groupLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds a group to the specified product via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, groupLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ProductGroupLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds a group to the specified product via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, groupLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ProductGroupLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/groupLinks/", false); + uri.AppendPath(groupLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified group from the specified product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, groupLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified group from the specified product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, groupLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the group links associated with a product. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, productId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductGroupLinkListResult.DeserializeProductGroupLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the group links associated with a product. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, productId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductGroupLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductGroupLinkListResult.DeserializeProductGroupLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductPolicyRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductPolicyRestOperations.cs new file mode 100644 index 000000000000..2fe9cba3648a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductPolicyRestOperations.cs @@ -0,0 +1,534 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceProductPolicyRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceProductPolicyRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceProductPolicyRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/policies", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy configuration at the Product level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy configuration at the Product level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyListResult.DeserializePolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the ETag of the policy configuration at the Product level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the ETag of the policy configuration at the Product level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, PolicyExportFormat? format) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + if (format != null) + { + uri.AppendQuery("format", format.Value.ToString(), true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the policy configuration at the Product level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId, format); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the policy configuration at the Product level. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId, format); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PolicyContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, PolicyContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates policy configuration for the Product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates policy configuration for the Product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + PolicyContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PolicyContractData.DeserializePolicyContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyId.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the policy configuration at the Product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the policy configuration at the Product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The identifier of the Policy. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, policyId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductRestOperations.cs new file mode 100644 index 000000000000..c53a9b0a29d8 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceProductRestOperations.cs @@ -0,0 +1,733 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceProductRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceProductRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceProductRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip, bool? expandGroups, string tags) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + if (expandGroups != null) + { + uri.AppendQuery("expandGroups", expandGroups.Value, true); + } + if (tags != null) + { + uri.AppendQuery("tags", tags, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of products in the specified workspace in a service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// When set to true, the response contains an array of groups that have visibility to the product. The default is false. + /// Products which are part of a specific tag. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, expandGroups, tags); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductListResult.DeserializeProductListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of products in the specified workspace in a service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// When set to true, the response contains an array of groups that have visibility to the product. The default is false. + /// Products which are part of a specific tag. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, expandGroups, tags); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductListResult.DeserializeProductListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the product specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the product specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the product specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiManagementProductData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementProductData.DeserializeApiManagementProductData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementProductData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the product specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiManagementProductData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementProductData.DeserializeApiManagementProductData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ApiManagementProductData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, ApiManagementProductData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or Updates a product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, ApiManagementProductData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiManagementProductData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementProductData.DeserializeApiManagementProductData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or Updates a product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, ApiManagementProductData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ApiManagementProductData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementProductData.DeserializeApiManagementProductData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, ETag ifMatch, ProductUpdateParameters productUpdateParameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(productUpdateParameters); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update existing product details. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, ETag ifMatch, ProductUpdateParameters productUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(productUpdateParameters, nameof(productUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, ifMatch, productUpdateParameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApiManagementProductData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApiManagementProductData.DeserializeApiManagementProductData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update existing product details. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, ETag ifMatch, ProductUpdateParameters productUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(productUpdateParameters, nameof(productUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, ifMatch, productUpdateParameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApiManagementProductData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApiManagementProductData.DeserializeApiManagementProductData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, ETag ifMatch, bool? deleteSubscriptions) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/products/", false); + uri.AppendPath(productId, true); + if (deleteSubscriptions != null) + { + uri.AppendQuery("deleteSubscriptions", deleteSubscriptions.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// 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. + /// Delete existing subscriptions associated with the product or not. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, ETag ifMatch, bool? deleteSubscriptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, ifMatch, deleteSubscriptions); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Product identifier. Must be unique in the current API Management service instance. + /// 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. + /// Delete existing subscriptions associated with the product or not. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, ETag ifMatch, bool? deleteSubscriptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, productId, ifMatch, deleteSubscriptions); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip, bool? expandGroups, string tags) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of products in the specified workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// When set to true, the response contains an array of groups that have visibility to the product. The default is false. + /// Products which are part of a specific tag. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, expandGroups, tags); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProductListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProductListResult.DeserializeProductListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of products in the specified workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// When set to true, the response contains an array of groups that have visibility to the product. The default is false. + /// Products which are part of a specific tag. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, expandGroups, tags); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProductListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProductListResult.DeserializeProductListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceRestOperations.cs new file mode 100644 index 000000000000..7d3f6d7648dc --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceRestOperations.cs @@ -0,0 +1,671 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all workspaces of the API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br></br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkspaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkspaceListResult.DeserializeWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all workspaces of the API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br></br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkspaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkspaceListResult.DeserializeWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the workspace specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the workspace specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the workspace specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkspaceContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkspaceContractData.DeserializeWorkspaceContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WorkspaceContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the workspace specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkspaceContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkspaceContractData.DeserializeWorkspaceContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WorkspaceContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, WorkspaceContractData data, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates a new workspace or updates an existing one. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, WorkspaceContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, data, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + WorkspaceContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkspaceContractData.DeserializeWorkspaceContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a new workspace or updates an existing one. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, WorkspaceContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, data, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + WorkspaceContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkspaceContractData.DeserializeWorkspaceContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, ETag ifMatch, WorkspaceContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the workspace specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Workspace Update parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, ETag ifMatch, WorkspaceContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, ifMatch, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkspaceContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkspaceContractData.DeserializeWorkspaceContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the workspace specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// Workspace Update parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, ETag ifMatch, WorkspaceContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, ifMatch, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkspaceContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkspaceContractData.DeserializeWorkspaceContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified workspace. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified workspace. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all workspaces of the API Management service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br></br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkspaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkspaceListResult.DeserializeWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all workspaces of the API Management service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br></br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkspaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkspaceListResult.DeserializeWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceSubscriptionRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceSubscriptionRestOperations.cs new file mode 100644 index 000000000000..1e1aba04e97f --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceSubscriptionRestOperations.cs @@ -0,0 +1,1004 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceSubscriptionRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceSubscriptionRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceSubscriptionRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/subscriptions", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all subscriptions of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubscriptionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubscriptionListResult.DeserializeSubscriptionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all subscriptions of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubscriptionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubscriptionListResult.DeserializeSubscriptionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityTagRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(sid, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityTagAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityTag(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateGetEntityTagRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(sid, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the specified Subscription entity. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubscriptionContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubscriptionContractData.DeserializeSubscriptionContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SubscriptionContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the specified Subscription entity. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubscriptionContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubscriptionContractData.DeserializeSubscriptionContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SubscriptionContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify, ETag? ifMatch, AppType? appType) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(sid, true); + if (notify != null) + { + uri.AppendQuery("notify", notify.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + if (appType != null) + { + uri.AppendQuery("appType", appType.Value.ToString(), true); + } + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(subscriptionCreateParameters); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates the subscription of specified user to the specified product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// Create parameters. + /// + /// 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 + /// + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// Determines the type of application which send the create user request. Default is legacy publisher portal. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + Argument.AssertNotNull(subscriptionCreateParameters, nameof(subscriptionCreateParameters)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid, subscriptionCreateParameters, notify, ifMatch, appType); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + SubscriptionContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubscriptionContractData.DeserializeSubscriptionContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates the subscription of specified user to the specified product. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// Create parameters. + /// + /// 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 + /// + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// Determines the type of application which send the create user request. Default is legacy publisher portal. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + Argument.AssertNotNull(subscriptionCreateParameters, nameof(subscriptionCreateParameters)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid, subscriptionCreateParameters, notify, ifMatch, appType); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + SubscriptionContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubscriptionContractData.DeserializeSubscriptionContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify, AppType? appType) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(sid, true); + if (notify != null) + { + uri.AppendQuery("notify", notify.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + if (appType != null) + { + uri.AppendQuery("appType", appType.Value.ToString(), true); + } + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(subscriptionUpdateParameters); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of a subscription specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// 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. + /// Update parameters. + /// + /// 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 + /// + /// Determines the type of application which send the create user request. Default is legacy publisher portal. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + Argument.AssertNotNull(subscriptionUpdateParameters, nameof(subscriptionUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid, ifMatch, subscriptionUpdateParameters, notify, appType); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubscriptionContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubscriptionContractData.DeserializeSubscriptionContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of a subscription specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// 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. + /// Update parameters. + /// + /// 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 + /// + /// Determines the type of application which send the create user request. Default is legacy publisher portal. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + Argument.AssertNotNull(subscriptionUpdateParameters, nameof(subscriptionUpdateParameters)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid, ifMatch, subscriptionUpdateParameters, notify, appType); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubscriptionContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubscriptionContractData.DeserializeSubscriptionContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(sid, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified subscription. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified subscription. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateRegeneratePrimaryKeyRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(sid, true); + uri.AppendPath("/regeneratePrimaryKey", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Regenerates primary key of existing subscription of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task RegeneratePrimaryKeyAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateRegeneratePrimaryKeyRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Regenerates primary key of existing subscription of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response RegeneratePrimaryKey(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateRegeneratePrimaryKeyRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateRegenerateSecondaryKeyRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(sid, true); + uri.AppendPath("/regenerateSecondaryKey", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Regenerates secondary key of existing subscription of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task RegenerateSecondaryKeyAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateRegenerateSecondaryKeyRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Regenerates secondary key of existing subscription of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response RegenerateSecondaryKey(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateRegenerateSecondaryKeyRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListSecretsRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(sid, true); + uri.AppendPath("/listSecrets", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the specified Subscription keys. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListSecretsAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateListSecretsRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubscriptionKeysContract value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubscriptionKeysContract.DeserializeSubscriptionKeysContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the specified Subscription keys. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListSecrets(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var message = CreateListSecretsRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, sid); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubscriptionKeysContract value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubscriptionKeysContract.DeserializeSubscriptionKeysContract(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all subscriptions of the workspace in an API Management service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubscriptionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubscriptionListResult.DeserializeSubscriptionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all subscriptions of the workspace in an API Management service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubscriptionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubscriptionListResult.DeserializeSubscriptionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagApiLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagApiLinkRestOperations.cs new file mode 100644 index 000000000000..0a8a435b203b --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagApiLinkRestOperations.cs @@ -0,0 +1,533 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceTagApiLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceTagApiLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceTagApiLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/apiLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the API links associated with a tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagApiLinkListResult.DeserializeTagApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the API links associated with a tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagApiLinkListResult.DeserializeTagApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the API link for the tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, apiLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagApiLinkContractData.DeserializeTagApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagApiLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the API link for the tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, apiLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagApiLinkContractData.DeserializeTagApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagApiLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId, TagApiLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds an API to the specified tag via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, apiLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagApiLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagApiLinkContractData.DeserializeTagApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds an API to the specified tag via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, apiLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagApiLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagApiLinkContractData.DeserializeTagApiLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/apiLinks/", false); + uri.AppendPath(apiLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified API from the specified tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, apiLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified API from the specified tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, apiLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the API links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagApiLinkListResult.DeserializeTagApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the API links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagApiLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagApiLinkListResult.DeserializeTagApiLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagOperationLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagOperationLinkRestOperations.cs new file mode 100644 index 000000000000..67659b8ca870 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagOperationLinkRestOperations.cs @@ -0,0 +1,533 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceTagOperationLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceTagOperationLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceTagOperationLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/operationLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the operation links associated with a tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagOperationLinkListResult.DeserializeTagOperationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the operation links associated with a tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagOperationLinkListResult.DeserializeTagOperationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/operationLinks/", false); + uri.AppendPath(operationLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the operation link for the tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, operationLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagOperationLinkContractData.DeserializeTagOperationLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagOperationLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the operation link for the tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, operationLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagOperationLinkContractData.DeserializeTagOperationLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagOperationLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId, TagOperationLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/operationLinks/", false); + uri.AppendPath(operationLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds an operation to the specified tag via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, operationLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagOperationLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagOperationLinkContractData.DeserializeTagOperationLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds an operation to the specified tag via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, operationLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagOperationLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagOperationLinkContractData.DeserializeTagOperationLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/operationLinks/", false); + uri.AppendPath(operationLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified operation from the specified tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, operationLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified operation from the specified tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, operationLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the operation links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagOperationLinkListResult.DeserializeTagOperationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the operation links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagOperationLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagOperationLinkListResult.DeserializeTagOperationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagProductLinkRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagProductLinkRestOperations.cs new file mode 100644 index 000000000000..d4d691b2a8f0 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagProductLinkRestOperations.cs @@ -0,0 +1,533 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceTagProductLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceTagProductLinkRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceTagProductLinkRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByProductRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/productLinks", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the product links associated with a tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagProductLinkListResult.DeserializeTagProductLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the product links associated with a tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProduct(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagProductLinkListResult.DeserializeTagProductLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/productLinks/", false); + uri.AppendPath(productLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the product link for the tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, productLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagProductLinkContractData.DeserializeTagProductLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagProductLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the product link for the tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, productLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagProductLinkContractData.DeserializeTagProductLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagProductLinkContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId, TagProductLinkContractData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/productLinks/", false); + uri.AppendPath(productLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds a product to the specified tag via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, productLinkId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagProductLinkContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagProductLinkContractData.DeserializeTagProductLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds a product to the specified tag via link. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, productLinkId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagProductLinkContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagProductLinkContractData.DeserializeTagProductLinkContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendPath("/productLinks/", false); + uri.AppendPath(productLinkId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified product from the specified tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, productLinkId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified product from the specified tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, productLinkId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByProductNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter, int? top, int? skip) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of the product links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByProductNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagProductLinkListResult.DeserializeTagProductLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of the product links associated with a tag. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByProductNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateListByProductNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, filter, top, skip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagProductLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagProductLinkListResult.DeserializeTagProductLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagRestOperations.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagRestOperations.cs new file mode 100644 index 000000000000..4111a9b6ad3a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/RestOperations/WorkspaceTagRestOperations.cs @@ -0,0 +1,719 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + internal partial class WorkspaceTagRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkspaceTagRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public WorkspaceTagRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByServiceRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip, string scope) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + if (scope != null) + { + uri.AppendQuery("scope", scope, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of tags defined within a workspace in a service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Scope like 'apis', 'products' or 'apis/{apiId}. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, string scope = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, scope); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagListResult.DeserializeTagListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of tags defined within a workspace in a service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Scope like 'apis', 'products' or 'apis/{apiId}. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByService(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, string scope = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, scope); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagListResult.DeserializeTagListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityStateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the entity state version of the tag specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetEntityStateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateGetEntityStateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the entity state version of the tag specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response GetEntityState(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateGetEntityStateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case int s when s >= 200 && s < 300: + { + bool value = true; + return Response.FromValue(value, message.Response); + } + case int s when s >= 400 && s < 500: + { + bool value = false; + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the tag specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagContractData.DeserializeTagContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the tag specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagContractData.DeserializeTagContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TagContractData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, ApiManagementTagCreateOrUpdateContent content, ETag? ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Creates a tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, ApiManagementTagCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, content, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagContractData.DeserializeTagContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a tag. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, ApiManagementTagCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, content, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + TagContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagContractData.DeserializeTagContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, ETag ifMatch, ApiManagementTagCreateOrUpdateContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Updates the details of the tag specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, ETag ifMatch, ApiManagementTagCreateOrUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, ifMatch, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagContractData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagContractData.DeserializeTagContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the details of the tag specified by its identifier. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, ETag ifMatch, ApiManagementTagCreateOrUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, ifMatch, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagContractData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagContractData.DeserializeTagContractData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, ETag ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ApiManagement/service/", false); + uri.AppendPath(serviceName, true); + uri.AppendPath("/workspaces/", false); + uri.AppendPath(workspaceId, true); + uri.AppendPath("/tags/", false); + uri.AppendPath(tagId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("If-Match", ifMatch); + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes specific tag of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes specific tag of the workspace in an API Management service instance. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Tag identifier. Must be unique in the current API Management service instance. + /// 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. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, ETag ifMatch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serviceName, workspaceId, tagId, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServiceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter, int? top, int? skip, string scope) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists a collection of tags defined within a workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Scope like 'apis', 'products' or 'apis/{apiId}. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByServiceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, string scope = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, scope); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TagListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TagListResult.DeserializeTagListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists a collection of tags defined within a workspace in a service instance. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the API Management service. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Scope like 'apis', 'products' or 'apis/{apiId}. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByServiceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string filter = null, int? top = null, int? skip = null, string scope = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var message = CreateListByServiceNextPageRequest(nextLink, subscriptionId, resourceGroupName, serviceName, workspaceId, filter, top, skip, scope); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TagListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TagListResult.DeserializeTagListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiCollection.cs similarity index 68% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiCollection.cs index 5d0ddba328bd..0b75f8bff2e8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiCollection.cs @@ -20,28 +20,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApis method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceApis method from an instance of . /// - public partial class ApiCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceApiCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiClientDiagnostics; - private readonly ApiRestOperations _apiRestClient; + private readonly ClientDiagnostics _serviceApiApiClientDiagnostics; + private readonly ApiRestOperations _serviceApiApiRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceApiCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiResource.ResourceType, out string apiApiVersion); - _apiRestClient = new ApiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiApiVersion); + _serviceApiApiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceApiResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceApiResource.ResourceType, out string serviceApiApiApiVersion); + _serviceApiApiRestClient = new ApiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiApiApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -68,22 +68,22 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// 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. - /// Create or update parameters. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string apiId, ApiCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(apiCreateOrUpdateParameter, nameof(apiCreateOrUpdateParameter)); - using var scope = _apiClientDiagnostics.CreateScope("ApiCollection.CreateOrUpdate"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, content, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(new ApiOperationSource(Client), _apiClientDiagnostics, Pipeline, _apiRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, content, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = await _serviceApiApiRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, apiCreateOrUpdateParameter, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceApiOperationSource(Client), _serviceApiApiClientDiagnostics, Pipeline, _serviceApiApiRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, apiCreateOrUpdateParameter, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -110,22 +110,22 @@ public virtual async Task> CreateOrUpdateAsync(WaitUnt /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// 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. - /// Create or update parameters. + /// Create or update parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string apiId, ApiCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(apiCreateOrUpdateParameter, nameof(apiCreateOrUpdateParameter)); - using var scope = _apiClientDiagnostics.CreateScope("ApiCollection.CreateOrUpdate"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, content, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(new ApiOperationSource(Client), _apiClientDiagnostics, Pipeline, _apiRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, content, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = _serviceApiApiRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, apiCreateOrUpdateParameter, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceApiOperationSource(Client), _serviceApiApiClientDiagnostics, Pipeline, _serviceApiApiRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, apiCreateOrUpdateParameter, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -154,18 +154,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, str /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string apiId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string apiId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _apiClientDiagnostics.CreateScope("ApiCollection.Get"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiCollection.Get"); scope.Start(); try { - var response = await _apiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiApiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -191,18 +191,18 @@ public virtual async Task> GetAsync(string apiId, Cancella /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string apiId, CancellationToken cancellationToken = default) + public virtual Response Get(string apiId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _apiClientDiagnostics.CreateScope("ApiCollection.Get"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiCollection.Get"); scope.Start(); try { - var response = _apiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken); + var response = _serviceApiApiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -230,12 +230,12 @@ public virtual Response Get(string apiId, CancellationToken cancell /// Include tags in the response. /// Include full ApiVersionSet resource in response. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiResource(Client, ApiData.DeserializeApiData(e)), _apiClientDiagnostics, Pipeline, "ApiCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiApiRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiApiRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceApiResource(Client, ApiData.DeserializeApiData(e)), _serviceApiApiClientDiagnostics, Pipeline, "ServiceApiCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -257,12 +257,12 @@ public virtual AsyncPageable GetAllAsync(string filter = null, int? /// Include tags in the response. /// Include full ApiVersionSet resource in response. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiResource(Client, ApiData.DeserializeApiData(e)), _apiClientDiagnostics, Pipeline, "ApiCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiApiRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiApiRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, tags, expandApiVersionSet); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceApiResource(Client, ApiData.DeserializeApiData(e)), _serviceApiApiClientDiagnostics, Pipeline, "ServiceApiCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -286,11 +286,11 @@ public virtual async Task> ExistsAsync(string apiId, Cancellation { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _apiClientDiagnostics.CreateScope("ApiCollection.Exists"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiCollection.Exists"); scope.Start(); try { - var response = await _apiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceApiApiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -321,11 +321,11 @@ public virtual Response Exists(string apiId, CancellationToken cancellatio { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _apiClientDiagnostics.CreateScope("ApiCollection.Exists"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiCollection.Exists"); scope.Start(); try { - var response = _apiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken: cancellationToken); + var response = _serviceApiApiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -335,7 +335,7 @@ public virtual Response Exists(string apiId, CancellationToken cancellatio } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -345,7 +345,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiOperationCollection.cs similarity index 68% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiOperationCollection.cs index c5f0494d8658..7df2a312f12c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiOperationCollection.cs @@ -19,28 +19,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiOperations method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceApiOperations method from an instance of . /// - public partial class ApiOperationCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceApiOperationCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiOperationClientDiagnostics; - private readonly ApiOperationRestOperations _apiOperationRestClient; + private readonly ClientDiagnostics _serviceApiOperationApiOperationClientDiagnostics; + private readonly ApiOperationRestOperations _serviceApiOperationApiOperationRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiOperationCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceApiOperationCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiOperationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiOperationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiOperationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiOperationResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiOperationResource.ResourceType, out string apiOperationApiVersion); - _apiOperationRestClient = new ApiOperationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiOperationApiVersion); + _serviceApiOperationApiOperationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceApiOperationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceApiOperationResource.ResourceType, out string serviceApiOperationApiOperationApiVersion); + _serviceApiOperationApiOperationRestClient = new ApiOperationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiOperationApiOperationApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -48,8 +48,8 @@ internal ApiOperationCollection(ArmClient client, ResourceIdentifier id) : base( internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiResource.ResourceType), nameof(id)); } /// @@ -72,17 +72,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string operationId, ApiOperationData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string operationId, ApiOperationData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationCollection.CreateOrUpdate"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiOperationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, data, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiOperationResource(Client, response), response.GetRawResponse())); + var response = await _serviceApiOperationApiOperationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiOperationResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -114,17 +114,17 @@ public virtual async Task> CreateOrUpdateAsyn /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string operationId, ApiOperationData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string operationId, ApiOperationData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationCollection.CreateOrUpdate"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiOperationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, data, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiOperationResource(Client, response), response.GetRawResponse())); + var response = _serviceApiOperationApiOperationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiOperationResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -153,18 +153,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitU /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string operationId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string operationId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationCollection.Get"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationCollection.Get"); scope.Start(); try { - var response = await _apiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiOperationApiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiOperationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -190,18 +190,18 @@ public virtual async Task> GetAsync(string operat /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string operationId, CancellationToken cancellationToken = default) + public virtual Response Get(string operationId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationCollection.Get"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationCollection.Get"); scope.Start(); try { - var response = _apiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken); + var response = _serviceApiOperationApiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiOperationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -228,12 +228,12 @@ public virtual Response Get(string operationId, Cancellati /// Number of records to skip. /// Include tags in the response. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiOperationRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiOperationRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiOperationResource(Client, ApiOperationData.DeserializeApiOperationData(e)), _apiOperationClientDiagnostics, Pipeline, "ApiOperationCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiOperationApiOperationRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiOperationApiOperationRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceApiOperationResource(Client, ApiOperationData.DeserializeApiOperationData(e)), _serviceApiOperationApiOperationClientDiagnostics, Pipeline, "ServiceApiOperationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -254,12 +254,12 @@ public virtual AsyncPageable GetAllAsync(string filter = n /// Number of records to skip. /// Include tags in the response. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiOperationRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiOperationRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiOperationResource(Client, ApiOperationData.DeserializeApiOperationData(e)), _apiOperationClientDiagnostics, Pipeline, "ApiOperationCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiOperationApiOperationRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiOperationApiOperationRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceApiOperationResource(Client, ApiOperationData.DeserializeApiOperationData(e)), _serviceApiOperationApiOperationClientDiagnostics, Pipeline, "ServiceApiOperationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -283,11 +283,11 @@ public virtual async Task> ExistsAsync(string operationId, Cancel { Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationCollection.Exists"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationCollection.Exists"); scope.Start(); try { - var response = await _apiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceApiOperationApiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -318,11 +318,11 @@ public virtual Response Exists(string operationId, CancellationToken cance { Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationCollection.Exists"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationCollection.Exists"); scope.Start(); try { - var response = _apiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken); + var response = _serviceApiOperationApiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -332,7 +332,7 @@ public virtual Response Exists(string operationId, CancellationToken cance } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -342,7 +342,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiOperationResource.cs similarity index 76% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiOperationResource.cs index 2aedff01129d..9ceb307131e0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiOperationResource.cs @@ -18,46 +18,46 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an ApiOperation along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiOperationResource method. - /// Otherwise you can get one from its parent resource using the GetApiOperation method. + /// A Class representing a ServiceApiOperation along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceApiOperationResource method. + /// Otherwise you can get one from its parent resource using the GetServiceApiOperation method. /// - public partial class ApiOperationResource : ArmResource + public partial class ServiceApiOperationResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string operationId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}"; return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiOperationClientDiagnostics; - private readonly ApiOperationRestOperations _apiOperationRestClient; + private readonly ClientDiagnostics _serviceApiOperationApiOperationClientDiagnostics; + private readonly ApiOperationRestOperations _serviceApiOperationApiOperationRestClient; private readonly ApiOperationData _data; - /// Initializes a new instance of the class for mocking. - protected ApiOperationResource() + /// Initializes a new instance of the class for mocking. + protected ServiceApiOperationResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiOperationResource(ArmClient client, ApiOperationData data) : this(client, data.Id) + internal ServiceApiOperationResource(ArmClient client, ApiOperationData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiOperationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiOperationResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiOperationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiOperationApiVersion); - _apiOperationRestClient = new ApiOperationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiOperationApiVersion); + _serviceApiOperationApiOperationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceApiOperationApiOperationApiVersion); + _serviceApiOperationApiOperationRestClient = new ApiOperationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiOperationApiOperationApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -87,7 +87,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } - /// Gets a collection of ApiOperationPolicyResources in the ApiOperation. + /// Gets a collection of ApiOperationPolicyResources in the ServiceApiOperation. /// An object representing collection of ApiOperationPolicyResources and their operations over a ApiOperationPolicyResource. public virtual ApiOperationPolicyCollection GetApiOperationPolicies() { @@ -138,7 +138,7 @@ public virtual Response GetApiOperationPolicy(Policy return GetApiOperationPolicies().Get(policyId, format, cancellationToken); } - /// Gets a collection of ApiOperationTagResources in the ApiOperation. + /// Gets a collection of ApiOperationTagResources in the ServiceApiOperation. /// An object representing collection of ApiOperationTagResources and their operations over a ApiOperationTagResource. public virtual ApiOperationTagCollection GetApiOperationTags() { @@ -205,16 +205,16 @@ public virtual Response GetApiOperationTag(string tagId /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationResource.Get"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationResource.Get"); scope.Start(); try { - var response = await _apiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiOperationApiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiOperationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -237,16 +237,16 @@ public virtual async Task> GetAsync(CancellationT /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationResource.Get"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationResource.Get"); scope.Start(); try { - var response = _apiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiOperationApiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiOperationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -273,11 +273,11 @@ public virtual Response Get(CancellationToken cancellation /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationResource.Delete"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationResource.Delete"); scope.Start(); try { - var response = await _apiOperationRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiOperationApiOperationRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -308,11 +308,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag if /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationResource.Delete"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationResource.Delete"); scope.Start(); try { - var response = _apiOperationRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var response = _serviceApiOperationApiOperationRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); @@ -339,19 +339,19 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, Cancellati /// /// /// 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. - /// API Operation Update parameters. + /// API Operation Update parameters. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(ETag ifMatch, ApiOperationPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, OperationUpdateContract operationUpdateContract, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(operationUpdateContract, nameof(operationUpdateContract)); - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationResource.Update"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationResource.Update"); scope.Start(); try { - var response = await _apiOperationRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ApiOperationResource(Client, response.Value), response.GetRawResponse()); + var response = await _serviceApiOperationApiOperationRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, operationUpdateContract, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceApiOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -374,19 +374,19 @@ public virtual async Task> UpdateAsync(ETag ifMat /// /// /// 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. - /// API Operation Update parameters. + /// API Operation Update parameters. /// The cancellation token to use. - /// is null. - public virtual Response Update(ETag ifMatch, ApiOperationPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(ETag ifMatch, OperationUpdateContract operationUpdateContract, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(operationUpdateContract, nameof(operationUpdateContract)); - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationResource.Update"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationResource.Update"); scope.Start(); try { - var response = _apiOperationRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken); - return Response.FromValue(new ApiOperationResource(Client, response.Value), response.GetRawResponse()); + var response = _serviceApiOperationApiOperationRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, operationUpdateContract, cancellationToken); + return Response.FromValue(new ServiceApiOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -411,11 +411,11 @@ public virtual Response Update(ETag ifMatch, ApiOperationP /// The cancellation token to use. public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) { - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationResource.GetEntityTag"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationResource.GetEntityTag"); scope.Start(); try { - var response = await _apiOperationRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiOperationApiOperationRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -441,11 +441,11 @@ public virtual async Task> GetEntityTagAsync(CancellationToken ca /// The cancellation token to use. public virtual Response GetEntityTag(CancellationToken cancellationToken = default) { - using var scope = _apiOperationClientDiagnostics.CreateScope("ApiOperationResource.GetEntityTag"); + using var scope = _serviceApiOperationApiOperationClientDiagnostics.CreateScope("ServiceApiOperationResource.GetEntityTag"); scope.Start(); try { - var response = _apiOperationRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiOperationApiOperationRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiReleaseCollection.cs similarity index 68% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiReleaseCollection.cs index c7c51a1dbc04..38497ce94850 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiReleaseCollection.cs @@ -19,28 +19,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiReleases method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceApiReleases method from an instance of . /// - public partial class ApiReleaseCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceApiReleaseCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiReleaseClientDiagnostics; - private readonly ApiReleaseRestOperations _apiReleaseRestClient; + private readonly ClientDiagnostics _serviceApiReleaseApiReleaseClientDiagnostics; + private readonly ApiReleaseRestOperations _serviceApiReleaseApiReleaseRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiReleaseCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceApiReleaseCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiReleaseCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiReleaseCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiReleaseClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiReleaseResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiReleaseResource.ResourceType, out string apiReleaseApiVersion); - _apiReleaseRestClient = new ApiReleaseRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiReleaseApiVersion); + _serviceApiReleaseApiReleaseClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceApiReleaseResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceApiReleaseResource.ResourceType, out string serviceApiReleaseApiReleaseApiVersion); + _serviceApiReleaseApiReleaseRestClient = new ApiReleaseRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiReleaseApiReleaseApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -48,8 +48,8 @@ internal ApiReleaseCollection(ArmClient client, ResourceIdentifier id) : base(cl internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiResource.ResourceType), nameof(id)); } /// @@ -72,17 +72,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string releaseId, ApiReleaseData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string releaseId, ApiReleaseData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseCollection.CreateOrUpdate"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiReleaseRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, data, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiReleaseResource(Client, response), response.GetRawResponse())); + var response = await _serviceApiReleaseApiReleaseRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiReleaseResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -114,17 +114,17 @@ public virtual async Task> CreateOrUpdateAsync( /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string releaseId, ApiReleaseData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string releaseId, ApiReleaseData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseCollection.CreateOrUpdate"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiReleaseRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, data, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiReleaseResource(Client, response), response.GetRawResponse())); + var response = _serviceApiReleaseApiReleaseRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiReleaseResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -153,18 +153,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUnt /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string releaseId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string releaseId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseCollection.Get"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseCollection.Get"); scope.Start(); try { - var response = await _apiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiReleaseApiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiReleaseResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiReleaseResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -190,18 +190,18 @@ public virtual async Task> GetAsync(string releaseI /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string releaseId, CancellationToken cancellationToken = default) + public virtual Response Get(string releaseId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseCollection.Get"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseCollection.Get"); scope.Start(); try { - var response = _apiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken); + var response = _serviceApiReleaseApiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiReleaseResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiReleaseResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -227,12 +227,12 @@ public virtual Response Get(string releaseId, CancellationTo /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiReleaseRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiReleaseRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiReleaseResource(Client, ApiReleaseData.DeserializeApiReleaseData(e)), _apiReleaseClientDiagnostics, Pipeline, "ApiReleaseCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiReleaseApiReleaseRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiReleaseApiReleaseRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceApiReleaseResource(Client, ApiReleaseData.DeserializeApiReleaseData(e)), _serviceApiReleaseApiReleaseClientDiagnostics, Pipeline, "ServiceApiReleaseCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -252,12 +252,12 @@ public virtual AsyncPageable GetAllAsync(string filter = nul /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiReleaseRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiReleaseRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiReleaseResource(Client, ApiReleaseData.DeserializeApiReleaseData(e)), _apiReleaseClientDiagnostics, Pipeline, "ApiReleaseCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiReleaseApiReleaseRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiReleaseApiReleaseRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceApiReleaseResource(Client, ApiReleaseData.DeserializeApiReleaseData(e)), _serviceApiReleaseApiReleaseClientDiagnostics, Pipeline, "ServiceApiReleaseCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -281,11 +281,11 @@ public virtual async Task> ExistsAsync(string releaseId, Cancella { Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseCollection.Exists"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseCollection.Exists"); scope.Start(); try { - var response = await _apiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceApiReleaseApiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -316,11 +316,11 @@ public virtual Response Exists(string releaseId, CancellationToken cancell { Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseCollection.Exists"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseCollection.Exists"); scope.Start(); try { - var response = _apiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken); + var response = _serviceApiReleaseApiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -330,7 +330,7 @@ public virtual Response Exists(string releaseId, CancellationToken cancell } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -340,7 +340,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiReleaseResource.cs similarity index 72% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiReleaseResource.cs index c8c9f87542da..4a373d7d4f48 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiReleaseResource.cs @@ -17,46 +17,46 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an ApiRelease along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiReleaseResource method. - /// Otherwise you can get one from its parent resource using the GetApiRelease method. + /// A Class representing a ServiceApiRelease along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceApiReleaseResource method. + /// Otherwise you can get one from its parent resource using the GetServiceApiRelease method. /// - public partial class ApiReleaseResource : ArmResource + public partial class ServiceApiReleaseResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string releaseId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}"; return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiReleaseClientDiagnostics; - private readonly ApiReleaseRestOperations _apiReleaseRestClient; + private readonly ClientDiagnostics _serviceApiReleaseApiReleaseClientDiagnostics; + private readonly ApiReleaseRestOperations _serviceApiReleaseApiReleaseRestClient; private readonly ApiReleaseData _data; - /// Initializes a new instance of the class for mocking. - protected ApiReleaseResource() + /// Initializes a new instance of the class for mocking. + protected ServiceApiReleaseResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiReleaseResource(ArmClient client, ApiReleaseData data) : this(client, data.Id) + internal ServiceApiReleaseResource(ArmClient client, ApiReleaseData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiReleaseResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiReleaseResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiReleaseClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiReleaseApiVersion); - _apiReleaseRestClient = new ApiReleaseRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiReleaseApiVersion); + _serviceApiReleaseApiReleaseClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceApiReleaseApiReleaseApiVersion); + _serviceApiReleaseApiReleaseRestClient = new ApiReleaseRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiReleaseApiReleaseApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -100,16 +100,16 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseResource.Get"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseResource.Get"); scope.Start(); try { - var response = await _apiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiReleaseApiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiReleaseResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiReleaseResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -132,16 +132,16 @@ public virtual async Task> GetAsync(CancellationTok /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseResource.Get"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseResource.Get"); scope.Start(); try { - var response = _apiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiReleaseApiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiReleaseResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiReleaseResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -168,11 +168,11 @@ public virtual Response Get(CancellationToken cancellationTo /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseResource.Delete"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseResource.Delete"); scope.Start(); try { - var response = await _apiReleaseRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiReleaseApiReleaseRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -203,11 +203,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag if /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseResource.Delete"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseResource.Delete"); scope.Start(); try { - var response = _apiReleaseRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var response = _serviceApiReleaseApiReleaseRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); @@ -237,16 +237,16 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, Cancellati /// API Release Update parameters. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(ETag ifMatch, ApiReleaseData data, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(ETag ifMatch, ApiReleaseData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseResource.Update"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseResource.Update"); scope.Start(); try { - var response = await _apiReleaseRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ApiReleaseResource(Client, response.Value), response.GetRawResponse()); + var response = await _serviceApiReleaseApiReleaseRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceApiReleaseResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -272,16 +272,16 @@ public virtual async Task> UpdateAsync(ETag ifMatch /// API Release Update parameters. /// The cancellation token to use. /// is null. - public virtual Response Update(ETag ifMatch, ApiReleaseData data, CancellationToken cancellationToken = default) + public virtual Response Update(ETag ifMatch, ApiReleaseData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseResource.Update"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseResource.Update"); scope.Start(); try { - var response = _apiReleaseRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken); - return Response.FromValue(new ApiReleaseResource(Client, response.Value), response.GetRawResponse()); + var response = _serviceApiReleaseApiReleaseRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken); + return Response.FromValue(new ServiceApiReleaseResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -306,11 +306,11 @@ public virtual Response Update(ETag ifMatch, ApiReleaseData /// The cancellation token to use. public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) { - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseResource.GetEntityTag"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseResource.GetEntityTag"); scope.Start(); try { - var response = await _apiReleaseRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiReleaseApiReleaseRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -336,11 +336,11 @@ public virtual async Task> GetEntityTagAsync(CancellationToken ca /// The cancellation token to use. public virtual Response GetEntityTag(CancellationToken cancellationToken = default) { - using var scope = _apiReleaseClientDiagnostics.CreateScope("ApiReleaseResource.GetEntityTag"); + using var scope = _serviceApiReleaseApiReleaseClientDiagnostics.CreateScope("ServiceApiReleaseResource.GetEntityTag"); scope.Start(); try { - var response = _apiReleaseRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiReleaseApiReleaseRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiResolverPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiResolverPolicyCollection.cs new file mode 100644 index 000000000000..ea469d3bf7a8 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiResolverPolicyCollection.cs @@ -0,0 +1,327 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceApiResolverPolicies method from an instance of . + /// + public partial class ServiceApiResolverPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics; + private readonly GraphQLApiResolverPolicyRestOperations _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceApiResolverPolicyCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceApiResolverPolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceApiResolverPolicyResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceApiResolverPolicyResource.ResourceType, out string serviceApiResolverPolicyGraphQLApiResolverPolicyApiVersion); + _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient = new GraphQLApiResolverPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiResolverPolicyGraphQLApiResolverPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResolverContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResolverContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates policy configuration for the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiResolverPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiResolverPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyCollection.Get"); + scope.Start(); + try + { + var response = await _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceApiResolverPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyCollection.Get"); + scope.Start(); + try + { + var response = _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceApiResolverPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the list of policy configuration at the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_ListByResolver + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.CreateListByResolverRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.CreateListByResolverNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceApiResolverPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics, Pipeline, "ServiceApiResolverPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Get the list of policy configuration at the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_ListByResolver + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.CreateListByResolverRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.CreateListByResolverNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceApiResolverPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics, Pipeline, "ServiceApiResolverPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> ExistsAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Exists(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyCollection.Exists"); + scope.Start(); + try + { + var response = _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiResolverPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiResolverPolicyResource.cs new file mode 100644 index 000000000000..e1c9e0179b66 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiResolverPolicyResource.cs @@ -0,0 +1,364 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceApiResolverPolicy along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceApiResolverPolicyResource method. + /// Otherwise you can get one from its parent resource using the GetServiceApiResolverPolicy method. + /// + public partial class ServiceApiResolverPolicyResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string resolverId, PolicyName policyId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics; + private readonly GraphQLApiResolverPolicyRestOperations _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient; + private readonly PolicyContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceApiResolverPolicyResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceApiResolverPolicyResource(ArmClient client, PolicyContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceApiResolverPolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceApiResolverPolicyGraphQLApiResolverPolicyApiVersion); + _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient = new GraphQLApiResolverPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiResolverPolicyGraphQLApiResolverPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/apis/resolvers/policies"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PolicyContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get the policy configuration at the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyResource.Get"); + scope.Start(); + try + { + var response = await _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceApiResolverPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyResource.Get"); + scope.Start(); + try + { + var response = _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceApiResolverPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the GraphQL Api Resolver. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyResource.Delete"); + scope.Start(); + try + { + var response = await _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the GraphQL Api Resolver. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyResource.Delete"); + scope.Start(); + try + { + var response = _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyResource.Update"); + scope.Start(); + try + { + var response = await _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiResolverPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the GraphQL API Resolver level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyResource.Update"); + scope.Start(); + try + { + var response = _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiResolverPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the GraphQL API resolver policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the GraphQL API resolver policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId}/policies/{policyId} + /// + /// + /// Operation Id + /// GraphQLApiResolverPolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceApiResolverPolicyGraphQLApiResolverPolicyClientDiagnostics.CreateScope("ServiceApiResolverPolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceApiResolverPolicyGraphQLApiResolverPolicyRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiResource.cs similarity index 79% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiResource.cs index aae52d4b3add..26516946c198 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiResource.cs @@ -18,22 +18,22 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an Api along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiResource method. - /// Otherwise you can get one from its parent resource using the GetApi method. + /// A Class representing a ServiceApi along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceApiResource method. + /// Otherwise you can get one from its parent resource using the GetServiceApi method. /// - public partial class ApiResource : ArmResource + public partial class ServiceApiResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"; return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiClientDiagnostics; - private readonly ApiRestOperations _apiRestClient; + private readonly ClientDiagnostics _serviceApiApiClientDiagnostics; + private readonly ApiRestOperations _serviceApiApiRestClient; private readonly ClientDiagnostics _apiRevisionClientDiagnostics; private readonly ApiRevisionRestOperations _apiRevisionRestClient; private readonly ClientDiagnostics _apiProductClientDiagnostics; @@ -42,28 +42,28 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly OperationRestOperations _operationRestClient; private readonly ApiData _data; - /// Initializes a new instance of the class for mocking. - protected ApiResource() + /// Initializes a new instance of the class for mocking. + protected ServiceApiResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiResource(ArmClient client, ApiData data) : this(client, data.Id) + internal ServiceApiResource(ArmClient client, ApiData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiApiVersion); - _apiRestClient = new ApiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiApiVersion); + _serviceApiApiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceApiApiApiVersion); + _serviceApiApiRestClient = new ApiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiApiApiVersion); _apiRevisionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); _apiRevisionRestClient = new ApiRevisionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _apiProductClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); @@ -99,11 +99,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } - /// Gets a collection of ApiReleaseResources in the Api. - /// An object representing collection of ApiReleaseResources and their operations over a ApiReleaseResource. - public virtual ApiReleaseCollection GetApiReleases() + /// Gets a collection of ServiceApiReleaseResources in the ServiceApi. + /// An object representing collection of ServiceApiReleaseResources and their operations over a ServiceApiReleaseResource. + public virtual ServiceApiReleaseCollection GetServiceApiReleases() { - return GetCachedClient(Client => new ApiReleaseCollection(Client, Id)); + return GetCachedClient(Client => new ServiceApiReleaseCollection(Client, Id)); } /// @@ -124,9 +124,9 @@ public virtual ApiReleaseCollection GetApiReleases() /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual async Task> GetApiReleaseAsync(string releaseId, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceApiReleaseAsync(string releaseId, CancellationToken cancellationToken = default) { - return await GetApiReleases().GetAsync(releaseId, cancellationToken).ConfigureAwait(false); + return await GetServiceApiReleases().GetAsync(releaseId, cancellationToken).ConfigureAwait(false); } /// @@ -147,16 +147,16 @@ public virtual async Task> GetApiReleaseAsync(strin /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual Response GetApiRelease(string releaseId, CancellationToken cancellationToken = default) + public virtual Response GetServiceApiRelease(string releaseId, CancellationToken cancellationToken = default) { - return GetApiReleases().Get(releaseId, cancellationToken); + return GetServiceApiReleases().Get(releaseId, cancellationToken); } - /// Gets a collection of ApiOperationResources in the Api. - /// An object representing collection of ApiOperationResources and their operations over a ApiOperationResource. - public virtual ApiOperationCollection GetApiOperations() + /// Gets a collection of ServiceApiOperationResources in the ServiceApi. + /// An object representing collection of ServiceApiOperationResources and their operations over a ServiceApiOperationResource. + public virtual ServiceApiOperationCollection GetServiceApiOperations() { - return GetCachedClient(Client => new ApiOperationCollection(Client, Id)); + return GetCachedClient(Client => new ServiceApiOperationCollection(Client, Id)); } /// @@ -177,9 +177,9 @@ public virtual ApiOperationCollection GetApiOperations() /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual async Task> GetApiOperationAsync(string operationId, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceApiOperationAsync(string operationId, CancellationToken cancellationToken = default) { - return await GetApiOperations().GetAsync(operationId, cancellationToken).ConfigureAwait(false); + return await GetServiceApiOperations().GetAsync(operationId, cancellationToken).ConfigureAwait(false); } /// @@ -200,12 +200,12 @@ public virtual async Task> GetApiOperationAsync(s /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual Response GetApiOperation(string operationId, CancellationToken cancellationToken = default) + public virtual Response GetServiceApiOperation(string operationId, CancellationToken cancellationToken = default) { - return GetApiOperations().Get(operationId, cancellationToken); + return GetServiceApiOperations().Get(operationId, cancellationToken); } - /// Gets a collection of ApiPolicyResources in the Api. + /// Gets a collection of ApiPolicyResources in the ServiceApi. /// An object representing collection of ApiPolicyResources and their operations over a ApiPolicyResource. public virtual ApiPolicyCollection GetApiPolicies() { @@ -256,7 +256,7 @@ public virtual Response GetApiPolicy(PolicyName policyId, Pol return GetApiPolicies().Get(policyId, format, cancellationToken); } - /// Gets a collection of ApiTagResources in the Api. + /// Gets a collection of ApiTagResources in the ServiceApi. /// An object representing collection of ApiTagResources and their operations over a ApiTagResource. public virtual ApiTagCollection GetApiTags() { @@ -309,11 +309,64 @@ public virtual Response GetApiTag(string tagId, CancellationToke return GetApiTags().Get(tagId, cancellationToken); } - /// Gets a collection of ApiSchemaResources in the Api. - /// An object representing collection of ApiSchemaResources and their operations over a ApiSchemaResource. - public virtual ApiSchemaCollection GetApiSchemas() + /// Gets a collection of ResolverContractResources in the ServiceApi. + /// An object representing collection of ResolverContractResources and their operations over a ResolverContractResource. + public virtual ResolverContractCollection GetResolverContracts() { - return GetCachedClient(Client => new ApiSchemaCollection(Client, Id)); + return GetCachedClient(Client => new ResolverContractCollection(Client, Id)); + } + + /// + /// Gets the details of the GraphQL API Resolver specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Get + /// + /// + /// + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetResolverContractAsync(string resolverId, CancellationToken cancellationToken = default) + { + return await GetResolverContracts().GetAsync(resolverId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the GraphQL API Resolver specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/resolvers/{resolverId} + /// + /// + /// Operation Id + /// GraphQLApiResolver_Get + /// + /// + /// + /// Resolver identifier within a GraphQL API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetResolverContract(string resolverId, CancellationToken cancellationToken = default) + { + return GetResolverContracts().Get(resolverId, cancellationToken); + } + + /// Gets a collection of ServiceApiSchemaResources in the ServiceApi. + /// An object representing collection of ServiceApiSchemaResources and their operations over a ServiceApiSchemaResource. + public virtual ServiceApiSchemaCollection GetServiceApiSchemas() + { + return GetCachedClient(Client => new ServiceApiSchemaCollection(Client, Id)); } /// @@ -334,9 +387,9 @@ public virtual ApiSchemaCollection GetApiSchemas() /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual async Task> GetApiSchemaAsync(string schemaId, CancellationToken cancellationToken = default) + public virtual async Task> GetServiceApiSchemaAsync(string schemaId, CancellationToken cancellationToken = default) { - return await GetApiSchemas().GetAsync(schemaId, cancellationToken).ConfigureAwait(false); + return await GetServiceApiSchemas().GetAsync(schemaId, cancellationToken).ConfigureAwait(false); } /// @@ -357,12 +410,12 @@ public virtual async Task> GetApiSchemaAsync(string /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public virtual Response GetApiSchema(string schemaId, CancellationToken cancellationToken = default) + public virtual Response GetServiceApiSchema(string schemaId, CancellationToken cancellationToken = default) { - return GetApiSchemas().Get(schemaId, cancellationToken); + return GetServiceApiSchemas().Get(schemaId, cancellationToken); } - /// Gets a collection of ApiDiagnosticResources in the Api. + /// Gets a collection of ApiDiagnosticResources in the ServiceApi. /// An object representing collection of ApiDiagnosticResources and their operations over a ApiDiagnosticResource. public virtual ApiDiagnosticCollection GetApiDiagnostics() { @@ -415,7 +468,7 @@ public virtual Response GetApiDiagnostic(string diagnosti return GetApiDiagnostics().Get(diagnosticId, cancellationToken); } - /// Gets a collection of ApiIssueResources in the Api. + /// Gets a collection of ApiIssueResources in the ServiceApi. /// An object representing collection of ApiIssueResources and their operations over a ApiIssueResource. public virtual ApiIssueCollection GetApiIssues() { @@ -470,7 +523,7 @@ public virtual Response GetApiIssue(string issueId, bool? expa return GetApiIssues().Get(issueId, expandCommentsAttachments, cancellationToken); } - /// Gets a collection of ApiTagDescriptionResources in the Api. + /// Gets a collection of ApiTagDescriptionResources in the ServiceApi. /// An object representing collection of ApiTagDescriptionResources and their operations over a ApiTagDescriptionResource. public virtual ApiTagDescriptionCollection GetApiTagDescriptions() { @@ -523,6 +576,13 @@ public virtual Response GetApiTagDescription(string t return GetApiTagDescriptions().Get(tagDescriptionId, cancellationToken); } + /// Gets an object representing a ServiceApiWikiResource along with the instance operations that can be performed on it in the ServiceApi. + /// Returns a object. + public virtual ServiceApiWikiResource GetServiceApiWiki() + { + return new ServiceApiWikiResource(Client, Id.AppendChildResource("wikis", "default")); + } + /// /// Gets the details of the API specified by its identifier. /// @@ -537,16 +597,16 @@ public virtual Response GetApiTagDescription(string t /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiClientDiagnostics.CreateScope("ApiResource.Get"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiResource.Get"); scope.Start(); try { - var response = await _apiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiApiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -569,16 +629,16 @@ public virtual async Task> GetAsync(CancellationToken canc /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiClientDiagnostics.CreateScope("ApiResource.Get"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiResource.Get"); scope.Start(); try { - var response = _apiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiApiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -606,11 +666,11 @@ public virtual Response Get(CancellationToken cancellationToken = d /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, bool? deleteRevisions = null, CancellationToken cancellationToken = default) { - using var scope = _apiClientDiagnostics.CreateScope("ApiResource.Delete"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiResource.Delete"); scope.Start(); try { - var response = await _apiRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteRevisions, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiApiRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteRevisions, cancellationToken).ConfigureAwait(false); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -642,11 +702,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag if /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, bool? deleteRevisions = null, CancellationToken cancellationToken = default) { - using var scope = _apiClientDiagnostics.CreateScope("ApiResource.Delete"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiResource.Delete"); scope.Start(); try { - var response = _apiRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteRevisions, cancellationToken); + var response = _serviceApiApiRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteRevisions, cancellationToken); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); @@ -673,19 +733,19 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, bool? dele /// /// /// 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. - /// API Update Contract parameters. + /// API Update Contract parameters. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(ETag ifMatch, ApiPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, ApiUpdateContract apiUpdateContract, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(apiUpdateContract, nameof(apiUpdateContract)); - using var scope = _apiClientDiagnostics.CreateScope("ApiResource.Update"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiResource.Update"); scope.Start(); try { - var response = await _apiRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ApiResource(Client, response.Value), response.GetRawResponse()); + var response = await _serviceApiApiRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, apiUpdateContract, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceApiResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -708,19 +768,19 @@ public virtual async Task> UpdateAsync(ETag ifMatch, ApiPa /// /// /// 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. - /// API Update Contract parameters. + /// API Update Contract parameters. /// The cancellation token to use. - /// is null. - public virtual Response Update(ETag ifMatch, ApiPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(ETag ifMatch, ApiUpdateContract apiUpdateContract, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(apiUpdateContract, nameof(apiUpdateContract)); - using var scope = _apiClientDiagnostics.CreateScope("ApiResource.Update"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiResource.Update"); scope.Start(); try { - var response = _apiRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken); - return Response.FromValue(new ApiResource(Client, response.Value), response.GetRawResponse()); + var response = _serviceApiApiRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, apiUpdateContract, cancellationToken); + return Response.FromValue(new ServiceApiResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -751,7 +811,7 @@ public virtual AsyncPageable GetApiRevisionsByServiceAsync( { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiRevisionRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiRevisionRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApiRevisionContract.DeserializeApiRevisionContract, _apiRevisionClientDiagnostics, Pipeline, "ApiResource.GetApiRevisionsByService", "value", "nextLink", cancellationToken); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApiRevisionContract.DeserializeApiRevisionContract, _apiRevisionClientDiagnostics, Pipeline, "ServiceApiResource.GetApiRevisionsByService", "value", "nextLink", cancellationToken); } /// @@ -776,7 +836,7 @@ public virtual Pageable GetApiRevisionsByService(string fil { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiRevisionRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiRevisionRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApiRevisionContract.DeserializeApiRevisionContract, _apiRevisionClientDiagnostics, Pipeline, "ApiResource.GetApiRevisionsByService", "value", "nextLink", cancellationToken); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApiRevisionContract.DeserializeApiRevisionContract, _apiRevisionClientDiagnostics, Pipeline, "ServiceApiResource.GetApiRevisionsByService", "value", "nextLink", cancellationToken); } /// @@ -796,12 +856,12 @@ public virtual Pageable GetApiRevisionsByService(string fil /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetApiProductsAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetApiProductsAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiProductRestClient.CreateListByApisRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiProductRestClient.CreateListByApisNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _apiProductClientDiagnostics, Pipeline, "ApiResource.GetApiProducts", "value", "nextLink", cancellationToken); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApiManagementProductData.DeserializeApiManagementProductData, _apiProductClientDiagnostics, Pipeline, "ServiceApiResource.GetApiProducts", "value", "nextLink", cancellationToken); } /// @@ -821,12 +881,12 @@ public virtual AsyncPageable GetApiProductsAsync(s /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetApiProducts(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetApiProducts(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _apiProductRestClient.CreateListByApisRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiProductRestClient.CreateListByApisNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _apiProductClientDiagnostics, Pipeline, "ApiResource.GetApiProducts", "value", "nextLink", cancellationToken); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApiManagementProductData.DeserializeApiManagementProductData, _apiProductClientDiagnostics, Pipeline, "ServiceApiResource.GetApiProducts", "value", "nextLink", cancellationToken); } /// @@ -852,7 +912,7 @@ public virtual AsyncPageable GetOperationsByTagsAsyn { HttpMessage FirstPageRequest(int? pageSizeHint) => _operationRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, includeNotTaggedOperations); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _operationRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, includeNotTaggedOperations); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _operationClientDiagnostics, Pipeline, "ApiResource.GetOperationsByTags", "value", "nextLink", cancellationToken); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _operationClientDiagnostics, Pipeline, "ServiceApiResource.GetOperationsByTags", "value", "nextLink", cancellationToken); } /// @@ -878,7 +938,7 @@ public virtual Pageable GetOperationsByTags(string f { HttpMessage FirstPageRequest(int? pageSizeHint) => _operationRestClient.CreateListByTagsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, includeNotTaggedOperations); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _operationRestClient.CreateListByTagsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, includeNotTaggedOperations); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _operationClientDiagnostics, Pipeline, "ApiResource.GetOperationsByTags", "value", "nextLink", cancellationToken); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, TagResourceContractDetails.DeserializeTagResourceContractDetails, _operationClientDiagnostics, Pipeline, "ServiceApiResource.GetOperationsByTags", "value", "nextLink", cancellationToken); } /// @@ -897,11 +957,11 @@ public virtual Pageable GetOperationsByTags(string f /// The cancellation token to use. public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) { - using var scope = _apiClientDiagnostics.CreateScope("ApiResource.GetEntityTag"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiResource.GetEntityTag"); scope.Start(); try { - var response = await _apiRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiApiRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -927,11 +987,11 @@ public virtual async Task> GetEntityTagAsync(CancellationToken ca /// The cancellation token to use. public virtual Response GetEntityTag(CancellationToken cancellationToken = default) { - using var scope = _apiClientDiagnostics.CreateScope("ApiResource.GetEntityTag"); + using var scope = _serviceApiApiClientDiagnostics.CreateScope("ServiceApiResource.GetEntityTag"); scope.Start(); try { - var response = _apiRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiApiRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiSchemaCollection.cs similarity index 66% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiSchemaCollection.cs index f6de4466c4a6..0ae70b23c0fb 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiSchemaCollection.cs @@ -19,28 +19,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiSchemas method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceApiSchemas method from an instance of . /// - public partial class ApiSchemaCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceApiSchemaCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiSchemaClientDiagnostics; - private readonly ApiSchemaRestOperations _apiSchemaRestClient; + private readonly ClientDiagnostics _serviceApiSchemaApiSchemaClientDiagnostics; + private readonly ApiSchemaRestOperations _serviceApiSchemaApiSchemaRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiSchemaCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceApiSchemaCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiSchemaCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiSchemaCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiSchemaResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiSchemaResource.ResourceType, out string apiSchemaApiVersion); - _apiSchemaRestClient = new ApiSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiSchemaApiVersion); + _serviceApiSchemaApiSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceApiSchemaResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceApiSchemaResource.ResourceType, out string serviceApiSchemaApiSchemaApiVersion); + _serviceApiSchemaApiSchemaRestClient = new ApiSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiSchemaApiSchemaApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -48,8 +48,8 @@ internal ApiSchemaCollection(ArmClient client, ResourceIdentifier id) : base(cli internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != ApiResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiResource.ResourceType), nameof(id)); + if (id.ResourceType != ServiceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceApiResource.ResourceType), nameof(id)); } /// @@ -72,17 +72,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string schemaId, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string schemaId, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaCollection.CreateOrUpdate"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(new ApiSchemaOperationSource(Client), _apiSchemaClientDiagnostics, Pipeline, _apiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = await _serviceApiSchemaApiSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceApiSchemaOperationSource(Client), _serviceApiSchemaApiSchemaClientDiagnostics, Pipeline, _serviceApiSchemaApiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -114,17 +114,17 @@ public virtual async Task> CreateOrUpdateAsync(W /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string schemaId, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string schemaId, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaCollection.CreateOrUpdate"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(new ApiSchemaOperationSource(Client), _apiSchemaClientDiagnostics, Pipeline, _apiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = _serviceApiSchemaApiSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceApiSchemaOperationSource(Client), _serviceApiSchemaApiSchemaClientDiagnostics, Pipeline, _serviceApiSchemaApiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -153,18 +153,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUnti /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string schemaId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string schemaId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaCollection.Get"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaCollection.Get"); scope.Start(); try { - var response = await _apiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiSchemaApiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiSchemaResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -190,18 +190,18 @@ public virtual async Task> GetAsync(string schemaId, /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string schemaId, CancellationToken cancellationToken = default) + public virtual Response Get(string schemaId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaCollection.Get"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaCollection.Get"); scope.Start(); try { - var response = _apiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken); + var response = _serviceApiSchemaApiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiSchemaResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -227,12 +227,12 @@ public virtual Response Get(string schemaId, CancellationToke /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiSchemaRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiSchemaRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiSchemaResource(Client, ApiSchemaData.DeserializeApiSchemaData(e)), _apiSchemaClientDiagnostics, Pipeline, "ApiSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiSchemaApiSchemaRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiSchemaApiSchemaRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceApiSchemaResource(Client, ApiSchemaData.DeserializeApiSchemaData(e)), _serviceApiSchemaApiSchemaClientDiagnostics, Pipeline, "ServiceApiSchemaCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -252,12 +252,12 @@ public virtual AsyncPageable GetAllAsync(string filter = null /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiSchemaRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiSchemaRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiSchemaResource(Client, ApiSchemaData.DeserializeApiSchemaData(e)), _apiSchemaClientDiagnostics, Pipeline, "ApiSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiSchemaApiSchemaRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiSchemaApiSchemaRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceApiSchemaResource(Client, ApiSchemaData.DeserializeApiSchemaData(e)), _serviceApiSchemaApiSchemaClientDiagnostics, Pipeline, "ServiceApiSchemaCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -281,11 +281,11 @@ public virtual async Task> ExistsAsync(string schemaId, Cancellat { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaCollection.Exists"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaCollection.Exists"); scope.Start(); try { - var response = await _apiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceApiSchemaApiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -316,11 +316,11 @@ public virtual Response Exists(string schemaId, CancellationToken cancella { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaCollection.Exists"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaCollection.Exists"); scope.Start(); try { - var response = _apiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken); + var response = _serviceApiSchemaApiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -330,7 +330,7 @@ public virtual Response Exists(string schemaId, CancellationToken cancella } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -340,7 +340,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiSchemaResource.cs similarity index 72% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiSchemaResource.cs index b766bf2577df..6337823452e7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiSchemaResource.cs @@ -17,46 +17,46 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an ApiSchema along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiSchemaResource method. - /// Otherwise you can get one from its parent resource using the GetApiSchema method. + /// A Class representing a ServiceApiSchema along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceApiSchemaResource method. + /// Otherwise you can get one from its parent resource using the GetServiceApiSchema method. /// - public partial class ApiSchemaResource : ArmResource + public partial class ServiceApiSchemaResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string schemaId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}"; return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiSchemaClientDiagnostics; - private readonly ApiSchemaRestOperations _apiSchemaRestClient; + private readonly ClientDiagnostics _serviceApiSchemaApiSchemaClientDiagnostics; + private readonly ApiSchemaRestOperations _serviceApiSchemaApiSchemaRestClient; private readonly ApiSchemaData _data; - /// Initializes a new instance of the class for mocking. - protected ApiSchemaResource() + /// Initializes a new instance of the class for mocking. + protected ServiceApiSchemaResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiSchemaResource(ArmClient client, ApiSchemaData data) : this(client, data.Id) + internal ServiceApiSchemaResource(ArmClient client, ApiSchemaData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiSchemaResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiSchemaResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiSchemaApiVersion); - _apiSchemaRestClient = new ApiSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiSchemaApiVersion); + _serviceApiSchemaApiSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceApiSchemaApiSchemaApiVersion); + _serviceApiSchemaApiSchemaRestClient = new ApiSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiSchemaApiSchemaApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -100,16 +100,16 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaResource.Get"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaResource.Get"); scope.Start(); try { - var response = await _apiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiSchemaApiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiSchemaResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -132,16 +132,16 @@ public virtual async Task> GetAsync(CancellationToke /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaResource.Get"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaResource.Get"); scope.Start(); try { - var response = _apiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiSchemaApiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiSchemaResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -169,11 +169,11 @@ public virtual Response Get(CancellationToken cancellationTok /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, bool? force = null, CancellationToken cancellationToken = default) { - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaResource.Delete"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaResource.Delete"); scope.Start(); try { - var response = await _apiSchemaRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, force, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiSchemaApiSchemaRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, force, cancellationToken).ConfigureAwait(false); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -205,11 +205,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag if /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, bool? force = null, CancellationToken cancellationToken = default) { - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaResource.Delete"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaResource.Delete"); scope.Start(); try { - var response = _apiSchemaRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, force, cancellationToken); + var response = _serviceApiSchemaApiSchemaRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, force, cancellationToken); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); @@ -240,16 +240,16 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, bool? forc /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaResource.Update"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaResource.Update"); scope.Start(); try { - var response = await _apiSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(new ApiSchemaOperationSource(Client), _apiSchemaClientDiagnostics, Pipeline, _apiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = await _serviceApiSchemaApiSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceApiSchemaOperationSource(Client), _serviceApiSchemaApiSchemaClientDiagnostics, Pipeline, _serviceApiSchemaApiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -279,16 +279,16 @@ public virtual async Task> UpdateAsync(WaitUntil /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaResource.Update"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaResource.Update"); scope.Start(); try { - var response = _apiSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(new ApiSchemaOperationSource(Client), _apiSchemaClientDiagnostics, Pipeline, _apiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = _serviceApiSchemaApiSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceApiSchemaOperationSource(Client), _serviceApiSchemaApiSchemaClientDiagnostics, Pipeline, _serviceApiSchemaApiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -316,11 +316,11 @@ public virtual ArmOperation Update(WaitUntil waitUntil, ApiSc /// The cancellation token to use. public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) { - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaResource.GetEntityTag"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaResource.GetEntityTag"); scope.Start(); try { - var response = await _apiSchemaRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiSchemaApiSchemaRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -346,11 +346,11 @@ public virtual async Task> GetEntityTagAsync(CancellationToken ca /// The cancellation token to use. public virtual Response GetEntityTag(CancellationToken cancellationToken = default) { - using var scope = _apiSchemaClientDiagnostics.CreateScope("ApiSchemaResource.GetEntityTag"); + using var scope = _serviceApiSchemaApiSchemaClientDiagnostics.CreateScope("ServiceApiSchemaResource.GetEntityTag"); scope.Start(); try { - var response = _apiSchemaRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiSchemaApiSchemaRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiVersionSetCollection.cs similarity index 67% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiVersionSetCollection.cs index 68d802b801dd..5d27a0de7425 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiVersionSetCollection.cs @@ -19,28 +19,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiVersionSets method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceApiVersionSets method from an instance of . /// - public partial class ApiVersionSetCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceApiVersionSetCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiVersionSetClientDiagnostics; - private readonly ApiVersionSetRestOperations _apiVersionSetRestClient; + private readonly ClientDiagnostics _serviceApiVersionSetApiVersionSetClientDiagnostics; + private readonly ApiVersionSetRestOperations _serviceApiVersionSetApiVersionSetRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiVersionSetCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceApiVersionSetCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiVersionSetCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiVersionSetCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiVersionSetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiVersionSetResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiVersionSetResource.ResourceType, out string apiVersionSetApiVersion); - _apiVersionSetRestClient = new ApiVersionSetRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiVersionSetApiVersion); + _serviceApiVersionSetApiVersionSetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceApiVersionSetResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceApiVersionSetResource.ResourceType, out string serviceApiVersionSetApiVersionSetApiVersion); + _serviceApiVersionSetApiVersionSetRestClient = new ApiVersionSetRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiVersionSetApiVersionSetApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -72,17 +72,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string versionSetId, ApiVersionSetData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string versionSetId, ApiVersionSetData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetCollection.CreateOrUpdate"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiVersionSetRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, data, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiVersionSetResource(Client, response), response.GetRawResponse())); + var response = await _serviceApiVersionSetApiVersionSetRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiVersionSetResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -114,17 +114,17 @@ public virtual async Task> CreateOrUpdateAsy /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string versionSetId, ApiVersionSetData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string versionSetId, ApiVersionSetData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetCollection.CreateOrUpdate"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiVersionSetRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, data, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiVersionSetResource(Client, response), response.GetRawResponse())); + var response = _serviceApiVersionSetApiVersionSetRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiVersionSetResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -153,18 +153,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wait /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string versionSetId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string versionSetId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetCollection.Get"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetCollection.Get"); scope.Start(); try { - var response = await _apiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiVersionSetApiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -190,18 +190,18 @@ public virtual async Task> GetAsync(string versi /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string versionSetId, CancellationToken cancellationToken = default) + public virtual Response Get(string versionSetId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetCollection.Get"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetCollection.Get"); scope.Start(); try { - var response = _apiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken); + var response = _serviceApiVersionSetApiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -227,12 +227,12 @@ public virtual Response Get(string versionSetId, Cancella /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiVersionSetRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiVersionSetRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiVersionSetResource(Client, ApiVersionSetData.DeserializeApiVersionSetData(e)), _apiVersionSetClientDiagnostics, Pipeline, "ApiVersionSetCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiVersionSetApiVersionSetRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiVersionSetApiVersionSetRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceApiVersionSetResource(Client, ApiVersionSetData.DeserializeApiVersionSetData(e)), _serviceApiVersionSetApiVersionSetClientDiagnostics, Pipeline, "ServiceApiVersionSetCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -252,12 +252,12 @@ public virtual AsyncPageable GetAllAsync(string filter = /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiVersionSetRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiVersionSetRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiVersionSetResource(Client, ApiVersionSetData.DeserializeApiVersionSetData(e)), _apiVersionSetClientDiagnostics, Pipeline, "ApiVersionSetCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceApiVersionSetApiVersionSetRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceApiVersionSetApiVersionSetRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceApiVersionSetResource(Client, ApiVersionSetData.DeserializeApiVersionSetData(e)), _serviceApiVersionSetApiVersionSetClientDiagnostics, Pipeline, "ServiceApiVersionSetCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -281,11 +281,11 @@ public virtual async Task> ExistsAsync(string versionSetId, Cance { Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetCollection.Exists"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetCollection.Exists"); scope.Start(); try { - var response = await _apiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceApiVersionSetApiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -316,11 +316,11 @@ public virtual Response Exists(string versionSetId, CancellationToken canc { Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetCollection.Exists"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetCollection.Exists"); scope.Start(); try { - var response = _apiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken: cancellationToken); + var response = _serviceApiVersionSetApiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, versionSetId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -330,7 +330,7 @@ public virtual Response Exists(string versionSetId, CancellationToken canc } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -340,7 +340,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiVersionSetResource.cs similarity index 69% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiVersionSetResource.cs index 5988a147144a..0fc7e79a39cf 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiVersionSetResource.cs @@ -18,46 +18,46 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an ApiVersionSet along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiVersionSetResource method. - /// Otherwise you can get one from its parent resource using the GetApiVersionSet method. + /// A Class representing a ServiceApiVersionSet along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceApiVersionSetResource method. + /// Otherwise you can get one from its parent resource using the GetServiceApiVersionSet method. /// - public partial class ApiVersionSetResource : ArmResource + public partial class ServiceApiVersionSetResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string versionSetId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}"; return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiVersionSetClientDiagnostics; - private readonly ApiVersionSetRestOperations _apiVersionSetRestClient; + private readonly ClientDiagnostics _serviceApiVersionSetApiVersionSetClientDiagnostics; + private readonly ApiVersionSetRestOperations _serviceApiVersionSetApiVersionSetRestClient; private readonly ApiVersionSetData _data; - /// Initializes a new instance of the class for mocking. - protected ApiVersionSetResource() + /// Initializes a new instance of the class for mocking. + protected ServiceApiVersionSetResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiVersionSetResource(ArmClient client, ApiVersionSetData data) : this(client, data.Id) + internal ServiceApiVersionSetResource(ArmClient client, ApiVersionSetData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiVersionSetResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceApiVersionSetResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiVersionSetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiVersionSetApiVersion); - _apiVersionSetRestClient = new ApiVersionSetRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiVersionSetApiVersion); + _serviceApiVersionSetApiVersionSetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceApiVersionSetApiVersionSetApiVersion); + _serviceApiVersionSetApiVersionSetRestClient = new ApiVersionSetRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiVersionSetApiVersionSetApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -101,16 +101,16 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetResource.Get"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetResource.Get"); scope.Start(); try { - var response = await _apiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiVersionSetApiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -133,16 +133,16 @@ public virtual async Task> GetAsync(Cancellation /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetResource.Get"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetResource.Get"); scope.Start(); try { - var response = _apiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiVersionSetApiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -169,11 +169,11 @@ public virtual Response Get(CancellationToken cancellatio /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetResource.Delete"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetResource.Delete"); scope.Start(); try { - var response = await _apiVersionSetRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiVersionSetApiVersionSetRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -204,11 +204,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag if /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetResource.Delete"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetResource.Delete"); scope.Start(); try { - var response = _apiVersionSetRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var response = _serviceApiVersionSetApiVersionSetRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); @@ -235,19 +235,19 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, Cancellati /// /// /// 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. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(ETag ifMatch, ApiVersionSetPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(apiVersionSetUpdateParameters, nameof(apiVersionSetUpdateParameters)); - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetResource.Update"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetResource.Update"); scope.Start(); try { - var response = await _apiVersionSetRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + var response = await _serviceApiVersionSetApiVersionSetRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, apiVersionSetUpdateParameters, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -270,19 +270,19 @@ public virtual async Task> UpdateAsync(ETag ifMa /// /// /// 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. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// is null. - public virtual Response Update(ETag ifMatch, ApiVersionSetPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(apiVersionSetUpdateParameters, nameof(apiVersionSetUpdateParameters)); - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetResource.Update"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetResource.Update"); scope.Start(); try { - var response = _apiVersionSetRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken); - return Response.FromValue(new ApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + var response = _serviceApiVersionSetApiVersionSetRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, apiVersionSetUpdateParameters, cancellationToken); + return Response.FromValue(new ServiceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -307,11 +307,11 @@ public virtual Response Update(ETag ifMatch, ApiVersionSe /// The cancellation token to use. public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) { - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetResource.GetEntityTag"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetResource.GetEntityTag"); scope.Start(); try { - var response = await _apiVersionSetRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceApiVersionSetApiVersionSetRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -337,11 +337,11 @@ public virtual async Task> GetEntityTagAsync(CancellationToken ca /// The cancellation token to use. public virtual Response GetEntityTag(CancellationToken cancellationToken = default) { - using var scope = _apiVersionSetClientDiagnostics.CreateScope("ApiVersionSetResource.GetEntityTag"); + using var scope = _serviceApiVersionSetApiVersionSetClientDiagnostics.CreateScope("ServiceApiVersionSetResource.GetEntityTag"); scope.Start(); try { - var response = _apiVersionSetRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceApiVersionSetApiVersionSetRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiWikiResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiWikiResource.cs new file mode 100644 index 000000000000..69ae603edde2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceApiWikiResource.cs @@ -0,0 +1,432 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceApiWiki along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceApiWikiResource method. + /// Otherwise you can get one from its parent resource using the GetServiceApiWiki method. + /// + public partial class ServiceApiWikiResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceApiWikiApiWikiClientDiagnostics; + private readonly ApiWikiRestOperations _serviceApiWikiApiWikiRestClient; + private readonly WikiContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceApiWikiResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceApiWikiResource(ArmClient client, WikiContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceApiWikiResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceApiWikiApiWikiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceApiWikiApiWikiApiVersion); + _serviceApiWikiApiWikiRestClient = new ApiWikiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceApiWikiApiWikiApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/apis/wikis"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual WikiContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the Wiki for an API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.Get"); + scope.Start(); + try + { + var response = await _serviceApiWikiApiWikiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceApiWikiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Wiki for an API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.Get"); + scope.Start(); + try + { + var response = _serviceApiWikiApiWikiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceApiWikiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified Wiki from an API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.Delete"); + scope.Start(); + try + { + var response = await _serviceApiWikiApiWikiRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified Wiki from an API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.Delete"); + scope.Start(); + try + { + var response = _serviceApiWikiApiWikiRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the Wiki for an API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_Update + /// + /// + /// + /// 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. + /// Wiki Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, WikiUpdateContract wikiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(wikiUpdateContract, nameof(wikiUpdateContract)); + + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.Update"); + scope.Start(); + try + { + var response = await _serviceApiWikiApiWikiRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, ifMatch, wikiUpdateContract, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceApiWikiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the Wiki for an API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_Update + /// + /// + /// + /// 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. + /// Wiki Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, WikiUpdateContract wikiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(wikiUpdateContract, nameof(wikiUpdateContract)); + + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.Update"); + scope.Start(); + try + { + var response = _serviceApiWikiApiWikiRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, ifMatch, wikiUpdateContract, cancellationToken); + return Response.FromValue(new ServiceApiWikiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new Wiki for an API or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, WikiContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceApiWikiApiWikiRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiWikiResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new Wiki for an API or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, WikiContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceApiWikiApiWikiRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceApiWikiResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Wiki for an API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceApiWikiApiWikiRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Wiki for an API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/wikis/default + /// + /// + /// Operation Id + /// ApiWiki_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceApiWikiApiWikiClientDiagnostics.CreateScope("ServiceApiWikiResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceApiWikiApiWikiRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceGroupCollection.cs similarity index 67% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceGroupCollection.cs index a9eff6a912ac..608254e76c26 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceGroupCollection.cs @@ -20,28 +20,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiManagementGroups method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceGroups method from an instance of . /// - public partial class ApiManagementGroupCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceGroupCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiManagementGroupGroupClientDiagnostics; - private readonly GroupRestOperations _apiManagementGroupGroupRestClient; + private readonly ClientDiagnostics _serviceGroupGroupClientDiagnostics; + private readonly GroupRestOperations _serviceGroupGroupRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiManagementGroupCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceGroupCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiManagementGroupCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceGroupCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementGroupGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiManagementGroupResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiManagementGroupResource.ResourceType, out string apiManagementGroupGroupApiVersion); - _apiManagementGroupGroupRestClient = new GroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementGroupGroupApiVersion); + _serviceGroupGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceGroupResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceGroupResource.ResourceType, out string serviceGroupGroupApiVersion); + _serviceGroupGroupRestClient = new GroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceGroupGroupApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -68,22 +68,22 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Group identifier. Must be unique in the current API Management service instance. - /// Create parameters. + /// Create parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string groupId, ApiManagementGroupCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(groupCreateParameters, nameof(groupCreateParameters)); - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupCollection.CreateOrUpdate"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiManagementGroupGroupRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, content, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementGroupResource(Client, response), response.GetRawResponse())); + var response = await _serviceGroupGroupRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, groupCreateParameters, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceGroupResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -110,22 +110,22 @@ public virtual async Task> CreateOrUpda /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Group identifier. Must be unique in the current API Management service instance. - /// Create parameters. + /// Create parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string groupId, ApiManagementGroupCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(groupCreateParameters, nameof(groupCreateParameters)); - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupCollection.CreateOrUpdate"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiManagementGroupGroupRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, content, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementGroupResource(Client, response), response.GetRawResponse())); + var response = _serviceGroupGroupRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, groupCreateParameters, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceGroupResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -154,18 +154,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string groupId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string groupId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupCollection.Get"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupCollection.Get"); scope.Start(); try { - var response = await _apiManagementGroupGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken).ConfigureAwait(false); + var response = await _serviceGroupGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGroupResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -191,18 +191,18 @@ public virtual async Task> GetAsync(string /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string groupId, CancellationToken cancellationToken = default) + public virtual Response Get(string groupId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupCollection.Get"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupCollection.Get"); scope.Start(); try { - var response = _apiManagementGroupGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken); + var response = _serviceGroupGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGroupResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -228,12 +228,12 @@ public virtual Response Get(string groupId, Cancella /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementGroupGroupRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementGroupGroupRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _apiManagementGroupGroupClientDiagnostics, Pipeline, "ApiManagementGroupCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceGroupGroupRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceGroupGroupRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _serviceGroupGroupClientDiagnostics, Pipeline, "ServiceGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -253,12 +253,12 @@ public virtual AsyncPageable GetAllAsync(string filt /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementGroupGroupRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementGroupGroupRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _apiManagementGroupGroupClientDiagnostics, Pipeline, "ApiManagementGroupCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceGroupGroupRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceGroupGroupRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _serviceGroupGroupClientDiagnostics, Pipeline, "ServiceGroupCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -282,11 +282,11 @@ public virtual async Task> ExistsAsync(string groupId, Cancellati { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupCollection.Exists"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupCollection.Exists"); scope.Start(); try { - var response = await _apiManagementGroupGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceGroupGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -317,11 +317,11 @@ public virtual Response Exists(string groupId, CancellationToken cancellat { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupCollection.Exists"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupCollection.Exists"); scope.Start(); try { - var response = _apiManagementGroupGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken); + var response = _serviceGroupGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, groupId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -331,7 +331,7 @@ public virtual Response Exists(string groupId, CancellationToken cancellat } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -341,7 +341,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceGroupResource.cs similarity index 83% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceGroupResource.cs index c29e580966b8..606c4c1a76be 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceGroupResource.cs @@ -18,48 +18,48 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an ApiManagementGroup along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiManagementGroupResource method. - /// Otherwise you can get one from its parent resource using the GetApiManagementGroup method. + /// A Class representing a ServiceGroup along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceGroupResource method. + /// Otherwise you can get one from its parent resource using the GetServiceGroup method. /// - public partial class ApiManagementGroupResource : ArmResource + public partial class ServiceGroupResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string groupId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}"; return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiManagementGroupGroupClientDiagnostics; - private readonly GroupRestOperations _apiManagementGroupGroupRestClient; + private readonly ClientDiagnostics _serviceGroupGroupClientDiagnostics; + private readonly GroupRestOperations _serviceGroupGroupRestClient; private readonly ClientDiagnostics _groupUserClientDiagnostics; private readonly GroupUserRestOperations _groupUserRestClient; private readonly ApiManagementGroupData _data; - /// Initializes a new instance of the class for mocking. - protected ApiManagementGroupResource() + /// Initializes a new instance of the class for mocking. + protected ServiceGroupResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiManagementGroupResource(ArmClient client, ApiManagementGroupData data) : this(client, data.Id) + internal ServiceGroupResource(ArmClient client, ApiManagementGroupData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiManagementGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementGroupGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiManagementGroupGroupApiVersion); - _apiManagementGroupGroupRestClient = new GroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementGroupGroupApiVersion); + _serviceGroupGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceGroupGroupApiVersion); + _serviceGroupGroupRestClient = new GroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceGroupGroupApiVersion); _groupUserClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); _groupUserRestClient = new GroupUserRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); #if DEBUG @@ -105,16 +105,16 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupResource.Get"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupResource.Get"); scope.Start(); try { - var response = await _apiManagementGroupGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceGroupGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGroupResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -137,16 +137,16 @@ public virtual async Task> GetAsync(Cancell /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupResource.Get"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupResource.Get"); scope.Start(); try { - var response = _apiManagementGroupGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceGroupGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGroupResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -173,11 +173,11 @@ public virtual Response Get(CancellationToken cancel /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupResource.Delete"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupResource.Delete"); scope.Start(); try { - var response = await _apiManagementGroupGroupRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var response = await _serviceGroupGroupRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -208,11 +208,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag if /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupResource.Delete"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupResource.Delete"); scope.Start(); try { - var response = _apiManagementGroupGroupRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var response = _serviceGroupGroupRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); @@ -239,19 +239,19 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, Cancellati /// /// /// 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. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(ETag ifMatch, ApiManagementGroupPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, GroupUpdateParameters groupUpdateParameters, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(groupUpdateParameters, nameof(groupUpdateParameters)); - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupResource.Update"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupResource.Update"); scope.Start(); try { - var response = await _apiManagementGroupGroupRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ApiManagementGroupResource(Client, response.Value), response.GetRawResponse()); + var response = await _serviceGroupGroupRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, groupUpdateParameters, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -274,19 +274,19 @@ public virtual async Task> UpdateAsync(ETag /// /// /// 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. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// is null. - public virtual Response Update(ETag ifMatch, ApiManagementGroupPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(ETag ifMatch, GroupUpdateParameters groupUpdateParameters, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(groupUpdateParameters, nameof(groupUpdateParameters)); - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupResource.Update"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupResource.Update"); scope.Start(); try { - var response = _apiManagementGroupGroupRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken); - return Response.FromValue(new ApiManagementGroupResource(Client, response.Value), response.GetRawResponse()); + var response = _serviceGroupGroupRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, groupUpdateParameters, cancellationToken); + return Response.FromValue(new ServiceGroupResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -317,7 +317,7 @@ public virtual AsyncPageable GetGroupUsersAsync(stri { HttpMessage FirstPageRequest(int? pageSizeHint) => _groupUserRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _groupUserRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApiManagementGroupUserData.DeserializeApiManagementGroupUserData, _groupUserClientDiagnostics, Pipeline, "ApiManagementGroupResource.GetGroupUsers", "value", "nextLink", cancellationToken); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApiManagementGroupUserData.DeserializeApiManagementGroupUserData, _groupUserClientDiagnostics, Pipeline, "ServiceGroupResource.GetGroupUsers", "value", "nextLink", cancellationToken); } /// @@ -342,7 +342,7 @@ public virtual Pageable GetGroupUsers(string filter { HttpMessage FirstPageRequest(int? pageSizeHint) => _groupUserRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _groupUserRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApiManagementGroupUserData.DeserializeApiManagementGroupUserData, _groupUserClientDiagnostics, Pipeline, "ApiManagementGroupResource.GetGroupUsers", "value", "nextLink", cancellationToken); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApiManagementGroupUserData.DeserializeApiManagementGroupUserData, _groupUserClientDiagnostics, Pipeline, "ServiceGroupResource.GetGroupUsers", "value", "nextLink", cancellationToken); } /// @@ -366,7 +366,7 @@ public virtual async Task> CheckGroupUserEntityExistsAsync(string { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _groupUserClientDiagnostics.CreateScope("ApiManagementGroupResource.CheckGroupUserEntityExists"); + using var scope = _groupUserClientDiagnostics.CreateScope("ServiceGroupResource.CheckGroupUserEntityExists"); scope.Start(); try { @@ -401,7 +401,7 @@ public virtual Response CheckGroupUserEntityExists(string userId, Cancella { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _groupUserClientDiagnostics.CreateScope("ApiManagementGroupResource.CheckGroupUserEntityExists"); + using var scope = _groupUserClientDiagnostics.CreateScope("ServiceGroupResource.CheckGroupUserEntityExists"); scope.Start(); try { @@ -436,7 +436,7 @@ public virtual async Task> CreateGroupUserA { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _groupUserClientDiagnostics.CreateScope("ApiManagementGroupResource.CreateGroupUser"); + using var scope = _groupUserClientDiagnostics.CreateScope("ServiceGroupResource.CreateGroupUser"); scope.Start(); try { @@ -471,7 +471,7 @@ public virtual Response CreateGroupUser(string userI { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _groupUserClientDiagnostics.CreateScope("ApiManagementGroupResource.CreateGroupUser"); + using var scope = _groupUserClientDiagnostics.CreateScope("ServiceGroupResource.CreateGroupUser"); scope.Start(); try { @@ -506,7 +506,7 @@ public virtual async Task DeleteGroupUserAsync(string userId, Cancella { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _groupUserClientDiagnostics.CreateScope("ApiManagementGroupResource.DeleteGroupUser"); + using var scope = _groupUserClientDiagnostics.CreateScope("ServiceGroupResource.DeleteGroupUser"); scope.Start(); try { @@ -541,7 +541,7 @@ public virtual Response DeleteGroupUser(string userId, CancellationToken cancell { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _groupUserClientDiagnostics.CreateScope("ApiManagementGroupResource.DeleteGroupUser"); + using var scope = _groupUserClientDiagnostics.CreateScope("ServiceGroupResource.DeleteGroupUser"); scope.Start(); try { @@ -571,11 +571,11 @@ public virtual Response DeleteGroupUser(string userId, CancellationToken cancell /// The cancellation token to use. public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupResource.GetEntityTag"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupResource.GetEntityTag"); scope.Start(); try { - var response = await _apiManagementGroupGroupRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceGroupGroupRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -601,11 +601,11 @@ public virtual async Task> GetEntityTagAsync(CancellationToken ca /// The cancellation token to use. public virtual Response GetEntityTag(CancellationToken cancellationToken = default) { - using var scope = _apiManagementGroupGroupClientDiagnostics.CreateScope("ApiManagementGroupResource.GetEntityTag"); + using var scope = _serviceGroupGroupClientDiagnostics.CreateScope("ServiceGroupResource.GetEntityTag"); scope.Start(); try { - var response = _apiManagementGroupGroupRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceGroupGroupRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNamedValueCollection.cs similarity index 63% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNamedValueCollection.cs index d6278c06161a..9a448702d922 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNamedValueCollection.cs @@ -20,28 +20,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiManagementNamedValues method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceNamedValues method from an instance of . /// - public partial class ApiManagementNamedValueCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceNamedValueCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiManagementNamedValueNamedValueClientDiagnostics; - private readonly NamedValueRestOperations _apiManagementNamedValueNamedValueRestClient; + private readonly ClientDiagnostics _serviceNamedValueNamedValueClientDiagnostics; + private readonly NamedValueRestOperations _serviceNamedValueNamedValueRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiManagementNamedValueCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceNamedValueCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiManagementNamedValueCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceNamedValueCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementNamedValueNamedValueClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiManagementNamedValueResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiManagementNamedValueResource.ResourceType, out string apiManagementNamedValueNamedValueApiVersion); - _apiManagementNamedValueNamedValueRestClient = new NamedValueRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementNamedValueNamedValueApiVersion); + _serviceNamedValueNamedValueClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceNamedValueResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceNamedValueResource.ResourceType, out string serviceNamedValueNamedValueApiVersion); + _serviceNamedValueNamedValueRestClient = new NamedValueRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceNamedValueNamedValueApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -68,22 +68,22 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Identifier of the NamedValue. - /// Create parameters. + /// Create parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string namedValueId, ApiManagementNamedValueCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(namedValueCreateContract, nameof(namedValueCreateContract)); - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueCollection.CreateOrUpdate"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiManagementNamedValueNamedValueRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, content, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(new ApiManagementNamedValueOperationSource(Client), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, _apiManagementNamedValueNamedValueRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, content, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = await _serviceNamedValueNamedValueRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, namedValueCreateContract, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceNamedValueOperationSource(Client), _serviceNamedValueNamedValueClientDiagnostics, Pipeline, _serviceNamedValueNamedValueRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, namedValueCreateContract, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -110,22 +110,22 @@ public virtual async Task> CreateO /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Identifier of the NamedValue. - /// Create parameters. + /// Create parameters. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string namedValueId, ApiManagementNamedValueCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(namedValueCreateContract, nameof(namedValueCreateContract)); - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueCollection.CreateOrUpdate"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiManagementNamedValueNamedValueRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, content, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(new ApiManagementNamedValueOperationSource(Client), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, _apiManagementNamedValueNamedValueRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, content, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = _serviceNamedValueNamedValueRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, namedValueCreateContract, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceNamedValueOperationSource(Client), _serviceNamedValueNamedValueClientDiagnostics, Pipeline, _serviceNamedValueNamedValueRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, namedValueCreateContract, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -154,18 +154,18 @@ public virtual ArmOperation CreateOrUpdate(Wait /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string namedValueId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string namedValueId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueCollection.Get"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueCollection.Get"); scope.Start(); try { - var response = await _apiManagementNamedValueNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken).ConfigureAwait(false); + var response = await _serviceNamedValueNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNamedValueResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceNamedValueResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -191,18 +191,18 @@ public virtual async Task> GetAsync(st /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string namedValueId, CancellationToken cancellationToken = default) + public virtual Response Get(string namedValueId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueCollection.Get"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueCollection.Get"); scope.Start(); try { - var response = _apiManagementNamedValueNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken); + var response = _serviceNamedValueNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNamedValueResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceNamedValueResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -229,12 +229,12 @@ public virtual Response Get(string namedValueId /// Number of records to skip. /// When set to true, the response contains only named value entities which failed refresh. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, bool? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, bool? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementNamedValueNamedValueRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementNamedValueNamedValueRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementNamedValueResource(Client, ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(e)), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, "ApiManagementNamedValueCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceNamedValueNamedValueRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceNamedValueNamedValueRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceNamedValueResource(Client, ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(e)), _serviceNamedValueNamedValueClientDiagnostics, Pipeline, "ServiceNamedValueCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -255,12 +255,12 @@ public virtual AsyncPageable GetAllAsync(string /// Number of records to skip. /// When set to true, the response contains only named value entities which failed refresh. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, bool? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, bool? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementNamedValueNamedValueRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementNamedValueNamedValueRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementNamedValueResource(Client, ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(e)), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, "ApiManagementNamedValueCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceNamedValueNamedValueRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceNamedValueNamedValueRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceNamedValueResource(Client, ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(e)), _serviceNamedValueNamedValueClientDiagnostics, Pipeline, "ServiceNamedValueCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -284,11 +284,11 @@ public virtual async Task> ExistsAsync(string namedValueId, Cance { Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueCollection.Exists"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueCollection.Exists"); scope.Start(); try { - var response = await _apiManagementNamedValueNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceNamedValueNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -319,11 +319,11 @@ public virtual Response Exists(string namedValueId, CancellationToken canc { Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueCollection.Exists"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueCollection.Exists"); scope.Start(); try { - var response = _apiManagementNamedValueNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken: cancellationToken); + var response = _serviceNamedValueNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, namedValueId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -333,7 +333,7 @@ public virtual Response Exists(string namedValueId, CancellationToken canc } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -343,7 +343,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNamedValueResource.cs similarity index 69% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNamedValueResource.cs index f01f823290f1..6614baaafaa2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNamedValueResource.cs @@ -18,46 +18,46 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an ApiManagementNamedValue along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiManagementNamedValueResource method. - /// Otherwise you can get one from its parent resource using the GetApiManagementNamedValue method. + /// A Class representing a ServiceNamedValue along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceNamedValueResource method. + /// Otherwise you can get one from its parent resource using the GetServiceNamedValue method. /// - public partial class ApiManagementNamedValueResource : ArmResource + public partial class ServiceNamedValueResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}"; return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiManagementNamedValueNamedValueClientDiagnostics; - private readonly NamedValueRestOperations _apiManagementNamedValueNamedValueRestClient; + private readonly ClientDiagnostics _serviceNamedValueNamedValueClientDiagnostics; + private readonly NamedValueRestOperations _serviceNamedValueNamedValueRestClient; private readonly ApiManagementNamedValueData _data; - /// Initializes a new instance of the class for mocking. - protected ApiManagementNamedValueResource() + /// Initializes a new instance of the class for mocking. + protected ServiceNamedValueResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiManagementNamedValueResource(ArmClient client, ApiManagementNamedValueData data) : this(client, data.Id) + internal ServiceNamedValueResource(ArmClient client, ApiManagementNamedValueData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiManagementNamedValueResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceNamedValueResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementNamedValueNamedValueClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiManagementNamedValueNamedValueApiVersion); - _apiManagementNamedValueNamedValueRestClient = new NamedValueRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementNamedValueNamedValueApiVersion); + _serviceNamedValueNamedValueClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceNamedValueNamedValueApiVersion); + _serviceNamedValueNamedValueRestClient = new NamedValueRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceNamedValueNamedValueApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -101,16 +101,16 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.Get"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.Get"); scope.Start(); try { - var response = await _apiManagementNamedValueNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceNamedValueNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNamedValueResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceNamedValueResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -133,16 +133,16 @@ public virtual async Task> GetAsync(Ca /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.Get"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.Get"); scope.Start(); try { - var response = _apiManagementNamedValueNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceNamedValueNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNamedValueResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceNamedValueResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -169,11 +169,11 @@ public virtual Response Get(CancellationToken c /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.Delete"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.Delete"); scope.Start(); try { - var response = await _apiManagementNamedValueNamedValueRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var response = await _serviceNamedValueNamedValueRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -204,11 +204,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag if /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.Delete"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.Delete"); scope.Start(); try { - var response = _apiManagementNamedValueNamedValueRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var response = _serviceNamedValueNamedValueRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); @@ -236,19 +236,19 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, Cancellati /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// 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. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ETag ifMatch, ApiManagementNamedValuePatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(namedValueUpdateParameters, nameof(namedValueUpdateParameters)); - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.Update"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.Update"); scope.Start(); try { - var response = await _apiManagementNamedValueNamedValueRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(new ApiManagementNamedValueOperationSource(Client), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, _apiManagementNamedValueNamedValueRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch).Request, response, OperationFinalStateVia.Location); + var response = await _serviceNamedValueNamedValueRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, namedValueUpdateParameters, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceNamedValueOperationSource(Client), _serviceNamedValueNamedValueClientDiagnostics, Pipeline, _serviceNamedValueNamedValueRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, namedValueUpdateParameters).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -275,19 +275,19 @@ public virtual async Task> UpdateA /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// 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. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ETag ifMatch, ApiManagementNamedValuePatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(namedValueUpdateParameters, nameof(namedValueUpdateParameters)); - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.Update"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.Update"); scope.Start(); try { - var response = _apiManagementNamedValueNamedValueRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken); - var operation = new ApiManagementArmOperation(new ApiManagementNamedValueOperationSource(Client), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, _apiManagementNamedValueNamedValueRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch).Request, response, OperationFinalStateVia.Location); + var response = _serviceNamedValueNamedValueRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, namedValueUpdateParameters, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceNamedValueOperationSource(Client), _serviceNamedValueNamedValueClientDiagnostics, Pipeline, _serviceNamedValueNamedValueRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, namedValueUpdateParameters).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -315,11 +315,11 @@ public virtual ArmOperation Update(WaitUntil wa /// The cancellation token to use. public virtual async Task> GetValueAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.GetValue"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.GetValue"); scope.Start(); try { - var response = await _apiManagementNamedValueNamedValueRestClient.ListValueAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceNamedValueNamedValueRestClient.ListValueAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -345,11 +345,11 @@ public virtual async Task> GetValueAsync(Canc /// The cancellation token to use. public virtual Response GetValue(CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.GetValue"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.GetValue"); scope.Start(); try { - var response = _apiManagementNamedValueNamedValueRestClient.ListValue(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceNamedValueNamedValueRestClient.ListValue(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) @@ -374,14 +374,14 @@ public virtual Response GetValue(CancellationToken can /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - public virtual async Task> RefreshSecretAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task> RefreshSecretAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.RefreshSecret"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.RefreshSecret"); scope.Start(); try { - var response = await _apiManagementNamedValueNamedValueRestClient.RefreshSecretAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(new ApiManagementNamedValueOperationSource(Client), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, _apiManagementNamedValueNamedValueRestClient.CreateRefreshSecretRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _serviceNamedValueNamedValueRestClient.RefreshSecretAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceNamedValueOperationSource(Client), _serviceNamedValueNamedValueClientDiagnostics, Pipeline, _serviceNamedValueNamedValueRestClient.CreateRefreshSecretRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -408,14 +408,14 @@ public virtual async Task> Refresh /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - public virtual ArmOperation RefreshSecret(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual ArmOperation RefreshSecret(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.RefreshSecret"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.RefreshSecret"); scope.Start(); try { - var response = _apiManagementNamedValueNamedValueRestClient.RefreshSecret(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new ApiManagementArmOperation(new ApiManagementNamedValueOperationSource(Client), _apiManagementNamedValueNamedValueClientDiagnostics, Pipeline, _apiManagementNamedValueNamedValueRestClient.CreateRefreshSecretRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _serviceNamedValueNamedValueRestClient.RefreshSecret(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceNamedValueOperationSource(Client), _serviceNamedValueNamedValueClientDiagnostics, Pipeline, _serviceNamedValueNamedValueRestClient.CreateRefreshSecretRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -443,11 +443,11 @@ public virtual ArmOperation RefreshSecret(WaitU /// The cancellation token to use. public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.GetEntityTag"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.GetEntityTag"); scope.Start(); try { - var response = await _apiManagementNamedValueNamedValueRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceNamedValueNamedValueRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -473,11 +473,11 @@ public virtual async Task> GetEntityTagAsync(CancellationToken ca /// The cancellation token to use. public virtual Response GetEntityTag(CancellationToken cancellationToken = default) { - using var scope = _apiManagementNamedValueNamedValueClientDiagnostics.CreateScope("ApiManagementNamedValueResource.GetEntityTag"); + using var scope = _serviceNamedValueNamedValueClientDiagnostics.CreateScope("ServiceNamedValueResource.GetEntityTag"); scope.Start(); try { - var response = _apiManagementNamedValueNamedValueRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceNamedValueNamedValueRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNotificationCollection.cs similarity index 61% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNotificationCollection.cs index 76d9fe3aea4e..4588a084c7fe 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNotificationCollection.cs @@ -20,28 +20,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiManagementNotifications method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceNotifications method from an instance of . /// - public partial class ApiManagementNotificationCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceNotificationCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiManagementNotificationNotificationClientDiagnostics; - private readonly NotificationRestOperations _apiManagementNotificationNotificationRestClient; + private readonly ClientDiagnostics _serviceNotificationNotificationClientDiagnostics; + private readonly NotificationRestOperations _serviceNotificationNotificationRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiManagementNotificationCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceNotificationCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiManagementNotificationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceNotificationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementNotificationNotificationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiManagementNotificationResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiManagementNotificationResource.ResourceType, out string apiManagementNotificationNotificationApiVersion); - _apiManagementNotificationNotificationRestClient = new NotificationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementNotificationNotificationApiVersion); + _serviceNotificationNotificationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceNotificationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceNotificationResource.ResourceType, out string serviceNotificationNotificationApiVersion); + _serviceNotificationNotificationRestClient = new NotificationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceNotificationNotificationApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -70,14 +70,14 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// Notification Name Identifier. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, NotificationName notificationName, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, NotificationName notificationName, ETag? ifMatch = null, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationCollection.CreateOrUpdate"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiManagementNotificationNotificationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementNotificationResource(Client, response), response.GetRawResponse())); + var response = await _serviceNotificationNotificationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceNotificationResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -106,14 +106,14 @@ public virtual async Task> Creat /// Notification Name Identifier. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, NotificationName notificationName, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, NotificationName notificationName, ETag? ifMatch = null, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationCollection.CreateOrUpdate"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiManagementNotificationNotificationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementNotificationResource(Client, response), response.GetRawResponse())); + var response = _serviceNotificationNotificationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceNotificationResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -140,16 +140,16 @@ public virtual ArmOperation CreateOrUpdate(Wa /// /// Notification Name Identifier. /// The cancellation token to use. - public virtual async Task> GetAsync(NotificationName notificationName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(NotificationName notificationName, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationCollection.Get"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationCollection.Get"); scope.Start(); try { - var response = await _apiManagementNotificationNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken).ConfigureAwait(false); + var response = await _serviceNotificationNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNotificationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceNotificationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -173,16 +173,16 @@ public virtual async Task> GetAsync( /// /// Notification Name Identifier. /// The cancellation token to use. - public virtual Response Get(NotificationName notificationName, CancellationToken cancellationToken = default) + public virtual Response Get(NotificationName notificationName, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationCollection.Get"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationCollection.Get"); scope.Start(); try { - var response = _apiManagementNotificationNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken); + var response = _serviceNotificationNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNotificationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceNotificationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -207,12 +207,12 @@ public virtual Response Get(NotificationName /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementNotificationNotificationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementNotificationNotificationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementNotificationResource(Client, ApiManagementNotificationData.DeserializeApiManagementNotificationData(e)), _apiManagementNotificationNotificationClientDiagnostics, Pipeline, "ApiManagementNotificationCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceNotificationNotificationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceNotificationNotificationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceNotificationResource(Client, ApiManagementNotificationData.DeserializeApiManagementNotificationData(e)), _serviceNotificationNotificationClientDiagnostics, Pipeline, "ServiceNotificationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -231,12 +231,12 @@ public virtual AsyncPageable GetAllAsync(int? /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementNotificationNotificationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementNotificationNotificationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementNotificationResource(Client, ApiManagementNotificationData.DeserializeApiManagementNotificationData(e)), _apiManagementNotificationNotificationClientDiagnostics, Pipeline, "ApiManagementNotificationCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceNotificationNotificationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceNotificationNotificationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceNotificationResource(Client, ApiManagementNotificationData.DeserializeApiManagementNotificationData(e)), _serviceNotificationNotificationClientDiagnostics, Pipeline, "ServiceNotificationCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -256,11 +256,11 @@ public virtual Pageable GetAll(int? top = nul /// The cancellation token to use. public virtual async Task> ExistsAsync(NotificationName notificationName, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationCollection.Exists"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationCollection.Exists"); scope.Start(); try { - var response = await _apiManagementNotificationNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceNotificationNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -287,11 +287,11 @@ public virtual async Task> ExistsAsync(NotificationName notificat /// The cancellation token to use. public virtual Response Exists(NotificationName notificationName, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationCollection.Exists"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationCollection.Exists"); scope.Start(); try { - var response = _apiManagementNotificationNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken: cancellationToken); + var response = _serviceNotificationNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, notificationName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -301,7 +301,7 @@ public virtual Response Exists(NotificationName notificationName, Cancella } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -311,7 +311,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNotificationResource.cs similarity index 85% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNotificationResource.cs index 9d8d77ad3642..e376d2149ffb 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceNotificationResource.cs @@ -18,50 +18,50 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an ApiManagementNotification along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiManagementNotificationResource method. - /// Otherwise you can get one from its parent resource using the GetApiManagementNotification method. + /// A Class representing a ServiceNotification along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceNotificationResource method. + /// Otherwise you can get one from its parent resource using the GetServiceNotification method. /// - public partial class ApiManagementNotificationResource : ArmResource + public partial class ServiceNotificationResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, NotificationName notificationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}"; return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiManagementNotificationNotificationClientDiagnostics; - private readonly NotificationRestOperations _apiManagementNotificationNotificationRestClient; + private readonly ClientDiagnostics _serviceNotificationNotificationClientDiagnostics; + private readonly NotificationRestOperations _serviceNotificationNotificationRestClient; private readonly ClientDiagnostics _notificationRecipientUserClientDiagnostics; private readonly NotificationRecipientUserRestOperations _notificationRecipientUserRestClient; private readonly ClientDiagnostics _notificationRecipientEmailClientDiagnostics; private readonly NotificationRecipientEmailRestOperations _notificationRecipientEmailRestClient; private readonly ApiManagementNotificationData _data; - /// Initializes a new instance of the class for mocking. - protected ApiManagementNotificationResource() + /// Initializes a new instance of the class for mocking. + protected ServiceNotificationResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiManagementNotificationResource(ArmClient client, ApiManagementNotificationData data) : this(client, data.Id) + internal ServiceNotificationResource(ArmClient client, ApiManagementNotificationData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiManagementNotificationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceNotificationResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementNotificationNotificationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiManagementNotificationNotificationApiVersion); - _apiManagementNotificationNotificationRestClient = new NotificationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementNotificationNotificationApiVersion); + _serviceNotificationNotificationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceNotificationNotificationApiVersion); + _serviceNotificationNotificationRestClient = new NotificationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceNotificationNotificationApiVersion); _notificationRecipientUserClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); _notificationRecipientUserRestClient = new NotificationRecipientUserRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _notificationRecipientEmailClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); @@ -109,16 +109,16 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationResource.Get"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationResource.Get"); scope.Start(); try { - var response = await _apiManagementNotificationNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceNotificationNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNotificationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceNotificationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -141,16 +141,16 @@ public virtual async Task> GetAsync( /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationResource.Get"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationResource.Get"); scope.Start(); try { - var response = _apiManagementNotificationNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceNotificationNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementNotificationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceNotificationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -175,14 +175,14 @@ public virtual Response Get(CancellationToken /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationResource.Update"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationResource.Update"); scope.Start(); try { - var response = await _apiManagementNotificationNotificationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementNotificationResource(Client, response), response.GetRawResponse())); + var response = await _serviceNotificationNotificationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceNotificationResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -210,14 +210,14 @@ public virtual async Task> Updat /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. - public virtual ArmOperation Update(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) { - using var scope = _apiManagementNotificationNotificationClientDiagnostics.CreateScope("ApiManagementNotificationResource.Update"); + using var scope = _serviceNotificationNotificationClientDiagnostics.CreateScope("ServiceNotificationResource.Update"); scope.Start(); try { - var response = _apiManagementNotificationNotificationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementNotificationResource(Client, response), response.GetRawResponse())); + var response = _serviceNotificationNotificationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceNotificationResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -247,7 +247,7 @@ public virtual ArmOperation Update(WaitUntil public virtual AsyncPageable GetNotificationRecipientUsersAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationRecipientUserRestClient.CreateListByNotificationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, RecipientUserContract.DeserializeRecipientUserContract, _notificationRecipientUserClientDiagnostics, Pipeline, "ApiManagementNotificationResource.GetNotificationRecipientUsers", "value", null, cancellationToken); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, RecipientUserContract.DeserializeRecipientUserContract, _notificationRecipientUserClientDiagnostics, Pipeline, "ServiceNotificationResource.GetNotificationRecipientUsers", "value", null, cancellationToken); } /// @@ -268,7 +268,7 @@ public virtual AsyncPageable GetNotificationRecipientUser public virtual Pageable GetNotificationRecipientUsers(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationRecipientUserRestClient.CreateListByNotificationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return PageableHelpers.CreatePageable(FirstPageRequest, null, RecipientUserContract.DeserializeRecipientUserContract, _notificationRecipientUserClientDiagnostics, Pipeline, "ApiManagementNotificationResource.GetNotificationRecipientUsers", "value", null, cancellationToken); + return PageableHelpers.CreatePageable(FirstPageRequest, null, RecipientUserContract.DeserializeRecipientUserContract, _notificationRecipientUserClientDiagnostics, Pipeline, "ServiceNotificationResource.GetNotificationRecipientUsers", "value", null, cancellationToken); } /// @@ -292,7 +292,7 @@ public virtual async Task> CheckNotificationRecipientUserEntityEx { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ApiManagementNotificationResource.CheckNotificationRecipientUserEntityExists"); + using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ServiceNotificationResource.CheckNotificationRecipientUserEntityExists"); scope.Start(); try { @@ -327,7 +327,7 @@ public virtual Response CheckNotificationRecipientUserEntityExists(string { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ApiManagementNotificationResource.CheckNotificationRecipientUserEntityExists"); + using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ServiceNotificationResource.CheckNotificationRecipientUserEntityExists"); scope.Start(); try { @@ -362,7 +362,7 @@ public virtual async Task> CreateOrUpdateNotific { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ApiManagementNotificationResource.CreateOrUpdateNotificationRecipientUser"); + using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ServiceNotificationResource.CreateOrUpdateNotificationRecipientUser"); scope.Start(); try { @@ -397,7 +397,7 @@ public virtual Response CreateOrUpdateNotificationRecipie { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ApiManagementNotificationResource.CreateOrUpdateNotificationRecipientUser"); + using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ServiceNotificationResource.CreateOrUpdateNotificationRecipientUser"); scope.Start(); try { @@ -432,7 +432,7 @@ public virtual async Task DeleteNotificationRecipientUserAsync(string { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ApiManagementNotificationResource.DeleteNotificationRecipientUser"); + using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ServiceNotificationResource.DeleteNotificationRecipientUser"); scope.Start(); try { @@ -467,7 +467,7 @@ public virtual Response DeleteNotificationRecipientUser(string userId, Cancellat { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ApiManagementNotificationResource.DeleteNotificationRecipientUser"); + using var scope = _notificationRecipientUserClientDiagnostics.CreateScope("ServiceNotificationResource.DeleteNotificationRecipientUser"); scope.Start(); try { @@ -499,7 +499,7 @@ public virtual Response DeleteNotificationRecipientUser(string userId, Cancellat public virtual AsyncPageable GetNotificationRecipientEmailsAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationRecipientEmailRestClient.CreateListByNotificationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, RecipientEmailContract.DeserializeRecipientEmailContract, _notificationRecipientEmailClientDiagnostics, Pipeline, "ApiManagementNotificationResource.GetNotificationRecipientEmails", "value", null, cancellationToken); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, RecipientEmailContract.DeserializeRecipientEmailContract, _notificationRecipientEmailClientDiagnostics, Pipeline, "ServiceNotificationResource.GetNotificationRecipientEmails", "value", null, cancellationToken); } /// @@ -520,7 +520,7 @@ public virtual AsyncPageable GetNotificationRecipientEma public virtual Pageable GetNotificationRecipientEmails(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _notificationRecipientEmailRestClient.CreateListByNotificationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return PageableHelpers.CreatePageable(FirstPageRequest, null, RecipientEmailContract.DeserializeRecipientEmailContract, _notificationRecipientEmailClientDiagnostics, Pipeline, "ApiManagementNotificationResource.GetNotificationRecipientEmails", "value", null, cancellationToken); + return PageableHelpers.CreatePageable(FirstPageRequest, null, RecipientEmailContract.DeserializeRecipientEmailContract, _notificationRecipientEmailClientDiagnostics, Pipeline, "ServiceNotificationResource.GetNotificationRecipientEmails", "value", null, cancellationToken); } /// @@ -544,7 +544,7 @@ public virtual async Task> CheckNotificationRecipientEmailEntityE { Argument.AssertNotNullOrEmpty(email, nameof(email)); - using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ApiManagementNotificationResource.CheckNotificationRecipientEmailEntityExists"); + using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ServiceNotificationResource.CheckNotificationRecipientEmailEntityExists"); scope.Start(); try { @@ -579,7 +579,7 @@ public virtual Response CheckNotificationRecipientEmailEntityExists(string { Argument.AssertNotNullOrEmpty(email, nameof(email)); - using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ApiManagementNotificationResource.CheckNotificationRecipientEmailEntityExists"); + using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ServiceNotificationResource.CheckNotificationRecipientEmailEntityExists"); scope.Start(); try { @@ -614,7 +614,7 @@ public virtual async Task> CreateOrUpdateNotifi { Argument.AssertNotNullOrEmpty(email, nameof(email)); - using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ApiManagementNotificationResource.CreateOrUpdateNotificationRecipientEmail"); + using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ServiceNotificationResource.CreateOrUpdateNotificationRecipientEmail"); scope.Start(); try { @@ -649,7 +649,7 @@ public virtual Response CreateOrUpdateNotificationRecipi { Argument.AssertNotNullOrEmpty(email, nameof(email)); - using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ApiManagementNotificationResource.CreateOrUpdateNotificationRecipientEmail"); + using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ServiceNotificationResource.CreateOrUpdateNotificationRecipientEmail"); scope.Start(); try { @@ -684,7 +684,7 @@ public virtual async Task DeleteNotificationRecipientEmailAsync(string { Argument.AssertNotNullOrEmpty(email, nameof(email)); - using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ApiManagementNotificationResource.DeleteNotificationRecipientEmail"); + using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ServiceNotificationResource.DeleteNotificationRecipientEmail"); scope.Start(); try { @@ -719,7 +719,7 @@ public virtual Response DeleteNotificationRecipientEmail(string email, Cancellat { Argument.AssertNotNullOrEmpty(email, nameof(email)); - using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ApiManagementNotificationResource.DeleteNotificationRecipientEmail"); + using var scope = _notificationRecipientEmailClientDiagnostics.CreateScope("ServiceNotificationResource.DeleteNotificationRecipientEmail"); scope.Start(); try { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServicePolicyFragmentCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServicePolicyFragmentCollection.cs new file mode 100644 index 000000000000..54bcc1347adf --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServicePolicyFragmentCollection.cs @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServicePolicyFragments method from an instance of . + /// + public partial class ServicePolicyFragmentCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _servicePolicyFragmentPolicyFragmentClientDiagnostics; + private readonly PolicyFragmentRestOperations _servicePolicyFragmentPolicyFragmentRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServicePolicyFragmentCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServicePolicyFragmentCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _servicePolicyFragmentPolicyFragmentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServicePolicyFragmentResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServicePolicyFragmentResource.ResourceType, out string servicePolicyFragmentPolicyFragmentApiVersion); + _servicePolicyFragmentPolicyFragmentRestClient = new PolicyFragmentRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, servicePolicyFragmentPolicyFragmentApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ApiManagementServiceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementServiceResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A resource identifier. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string id, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _servicePolicyFragmentPolicyFragmentRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServicePolicyFragmentOperationSource(Client), _servicePolicyFragmentPolicyFragmentClientDiagnostics, Pipeline, _servicePolicyFragmentPolicyFragmentRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A resource identifier. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string id, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _servicePolicyFragmentPolicyFragmentRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServicePolicyFragmentOperationSource(Client), _servicePolicyFragmentPolicyFragmentClientDiagnostics, Pipeline, _servicePolicyFragmentPolicyFragmentRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentCollection.Get"); + scope.Start(); + try + { + var response = await _servicePolicyFragmentPolicyFragmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServicePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentCollection.Get"); + scope.Start(); + try + { + var response = _servicePolicyFragmentPolicyFragmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServicePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets all policy fragments. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments + /// + /// + /// Operation Id + /// PolicyFragment_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _servicePolicyFragmentPolicyFragmentRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, orderBy, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ServicePolicyFragmentResource(Client, PolicyFragmentContractData.DeserializePolicyFragmentContractData(e)), _servicePolicyFragmentPolicyFragmentClientDiagnostics, Pipeline, "ServicePolicyFragmentCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Gets all policy fragments. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments + /// + /// + /// Operation Id + /// PolicyFragment_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _servicePolicyFragmentPolicyFragmentRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, orderBy, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, null, e => new ServicePolicyFragmentResource(Client, PolicyFragmentContractData.DeserializePolicyFragmentContractData(e)), _servicePolicyFragmentPolicyFragmentClientDiagnostics, Pipeline, "ServicePolicyFragmentCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentCollection.Exists"); + scope.Start(); + try + { + var response = await _servicePolicyFragmentPolicyFragmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, format, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentCollection.Exists"); + scope.Start(); + try + { + var response = _servicePolicyFragmentPolicyFragmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, id, format, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServicePolicyFragmentResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServicePolicyFragmentResource.cs new file mode 100644 index 000000000000..1321fe03dc9e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServicePolicyFragmentResource.cs @@ -0,0 +1,410 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServicePolicyFragment along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServicePolicyFragmentResource method. + /// Otherwise you can get one from its parent resource using the GetServicePolicyFragment method. + /// + public partial class ServicePolicyFragmentResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string id) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _servicePolicyFragmentPolicyFragmentClientDiagnostics; + private readonly PolicyFragmentRestOperations _servicePolicyFragmentPolicyFragmentRestClient; + private readonly PolicyFragmentContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServicePolicyFragmentResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServicePolicyFragmentResource(ArmClient client, PolicyFragmentContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServicePolicyFragmentResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _servicePolicyFragmentPolicyFragmentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string servicePolicyFragmentPolicyFragmentApiVersion); + _servicePolicyFragmentPolicyFragmentRestClient = new PolicyFragmentRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, servicePolicyFragmentPolicyFragmentApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/policyFragments"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PolicyFragmentContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Get + /// + /// + /// + /// Policy fragment content format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentResource.Get"); + scope.Start(); + try + { + var response = await _servicePolicyFragmentPolicyFragmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServicePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Get + /// + /// + /// + /// Policy fragment content format. + /// The cancellation token to use. + public virtual Response Get(PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentResource.Get"); + scope.Start(); + try + { + var response = _servicePolicyFragmentPolicyFragmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServicePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentResource.Delete"); + scope.Start(); + try + { + var response = await _servicePolicyFragmentPolicyFragmentRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentResource.Delete"); + scope.Start(); + try + { + var response = _servicePolicyFragmentPolicyFragmentRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentResource.Update"); + scope.Start(); + try + { + var response = await _servicePolicyFragmentPolicyFragmentRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServicePolicyFragmentOperationSource(Client), _servicePolicyFragmentPolicyFragmentClientDiagnostics, Pipeline, _servicePolicyFragmentPolicyFragmentRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentResource.Update"); + scope.Start(); + try + { + var response = _servicePolicyFragmentPolicyFragmentRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServicePolicyFragmentOperationSource(Client), _servicePolicyFragmentPolicyFragmentClientDiagnostics, Pipeline, _servicePolicyFragmentPolicyFragmentRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists policy resources that reference the policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}/listReferences + /// + /// + /// Operation Id + /// PolicyFragment_ListReferences + /// + /// + /// + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetReferencesAsync(int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _servicePolicyFragmentPolicyFragmentRestClient.CreateListReferencesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ResourceCollectionValueItem.DeserializeResourceCollectionValueItem, _servicePolicyFragmentPolicyFragmentClientDiagnostics, Pipeline, "ServicePolicyFragmentResource.GetReferences", "value", null, cancellationToken); + } + + /// + /// Lists policy resources that reference the policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}/listReferences + /// + /// + /// Operation Id + /// PolicyFragment_ListReferences + /// + /// + /// + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetReferences(int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _servicePolicyFragmentPolicyFragmentRestClient.CreateListReferencesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, null, ResourceCollectionValueItem.DeserializeResourceCollectionValueItem, _servicePolicyFragmentPolicyFragmentClientDiagnostics, Pipeline, "ServicePolicyFragmentResource.GetReferences", "value", null, cancellationToken); + } + + /// + /// Gets the entity state (Etag) version of a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _servicePolicyFragmentPolicyFragmentRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id} + /// + /// + /// Operation Id + /// PolicyFragment_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _servicePolicyFragmentPolicyFragmentClientDiagnostics.CreateScope("ServicePolicyFragmentResource.GetEntityTag"); + scope.Start(); + try + { + var response = _servicePolicyFragmentPolicyFragmentRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductApiLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductApiLinkCollection.cs new file mode 100644 index 000000000000..81e1f810a644 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductApiLinkCollection.cs @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceProductApiLinks method from an instance of . + /// + public partial class ServiceProductApiLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceProductApiLinkProductApiLinkClientDiagnostics; + private readonly ProductApiLinkRestOperations _serviceProductApiLinkProductApiLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceProductApiLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceProductApiLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceProductApiLinkProductApiLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceProductApiLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceProductApiLinkResource.ResourceType, out string serviceProductApiLinkProductApiLinkApiVersion); + _serviceProductApiLinkProductApiLinkRestClient = new ProductApiLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceProductApiLinkProductApiLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceProductResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceProductResource.ResourceType), nameof(id)); + } + + /// + /// Adds an API to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string apiLinkId, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceProductApiLinkProductApiLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string apiLinkId, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceProductApiLinkProductApiLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceProductApiLinkProductApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceProductApiLinkProductApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the API links associated with a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks + /// + /// + /// Operation Id + /// ProductApiLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceProductApiLinkProductApiLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceProductApiLinkProductApiLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceProductApiLinkResource(Client, ProductApiLinkContractData.DeserializeProductApiLinkContractData(e)), _serviceProductApiLinkProductApiLinkClientDiagnostics, Pipeline, "ServiceProductApiLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the API links associated with a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks + /// + /// + /// Operation Id + /// ProductApiLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceProductApiLinkProductApiLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceProductApiLinkProductApiLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceProductApiLinkResource(Client, ProductApiLinkContractData.DeserializeProductApiLinkContractData(e)), _serviceProductApiLinkProductApiLinkClientDiagnostics, Pipeline, "ServiceProductApiLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceProductApiLinkProductApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceProductApiLinkProductApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductApiLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductApiLinkResource.cs new file mode 100644 index 000000000000..659daa665f8d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductApiLinkResource.cs @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceProductApiLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceProductApiLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceProductApiLink method. + /// + public partial class ServiceProductApiLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string productId, string apiLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceProductApiLinkProductApiLinkClientDiagnostics; + private readonly ProductApiLinkRestOperations _serviceProductApiLinkProductApiLinkRestClient; + private readonly ProductApiLinkContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceProductApiLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceProductApiLinkResource(ArmClient client, ProductApiLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceProductApiLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceProductApiLinkProductApiLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceProductApiLinkProductApiLinkApiVersion); + _serviceProductApiLinkProductApiLinkRestClient = new ProductApiLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceProductApiLinkProductApiLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/products/apiLinks"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ProductApiLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceProductApiLinkProductApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceProductApiLinkProductApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API from the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceProductApiLinkProductApiLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API from the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceProductApiLinkProductApiLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceProductApiLinkProductApiLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductApiLinkProductApiLinkClientDiagnostics.CreateScope("ServiceProductApiLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceProductApiLinkProductApiLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductCollection.cs similarity index 69% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductCollection.cs index b957fc336fd9..235083709e7a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductCollection.cs @@ -19,28 +19,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiManagementProducts method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceProducts method from an instance of . /// - public partial class ApiManagementProductCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceProductCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiManagementProductProductClientDiagnostics; - private readonly ProductRestOperations _apiManagementProductProductRestClient; + private readonly ClientDiagnostics _serviceProductProductClientDiagnostics; + private readonly ProductRestOperations _serviceProductProductRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiManagementProductCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceProductCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiManagementProductCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceProductCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementProductProductClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiManagementProductResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiManagementProductResource.ResourceType, out string apiManagementProductProductApiVersion); - _apiManagementProductProductRestClient = new ProductRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementProductProductApiVersion); + _serviceProductProductClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceProductResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceProductResource.ResourceType, out string serviceProductProductApiVersion); + _serviceProductProductRestClient = new ProductRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceProductProductApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -72,17 +72,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string productId, ApiManagementProductData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string productId, ApiManagementProductData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(productId, nameof(productId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductCollection.CreateOrUpdate"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiManagementProductProductRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, data, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementProductResource(Client, response), response.GetRawResponse())); + var response = await _serviceProductProductRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -114,17 +114,17 @@ public virtual async Task> CreateOrUp /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string productId, ApiManagementProductData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string productId, ApiManagementProductData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(productId, nameof(productId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductCollection.CreateOrUpdate"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiManagementProductProductRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, data, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(Response.FromValue(new ApiManagementProductResource(Client, response), response.GetRawResponse())); + var response = _serviceProductProductRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -153,18 +153,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUnt /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string productId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string productId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(productId, nameof(productId)); - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductCollection.Get"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductCollection.Get"); scope.Start(); try { - var response = await _apiManagementProductProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken).ConfigureAwait(false); + var response = await _serviceProductProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementProductResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceProductResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -190,18 +190,18 @@ public virtual async Task> GetAsync(strin /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string productId, CancellationToken cancellationToken = default) + public virtual Response Get(string productId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(productId, nameof(productId)); - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductCollection.Get"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductCollection.Get"); scope.Start(); try { - var response = _apiManagementProductProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken); + var response = _serviceProductProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementProductResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceProductResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -229,12 +229,12 @@ public virtual Response Get(string productId, Canc /// When set to true, the response contains an array of groups that have visibility to the product. The default is false. /// Products which are part of a specific tag. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementProductProductRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementProductProductRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _apiManagementProductProductClientDiagnostics, Pipeline, "ApiManagementProductCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceProductProductRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceProductProductRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _serviceProductProductClientDiagnostics, Pipeline, "ServiceProductCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -256,12 +256,12 @@ public virtual AsyncPageable GetAllAsync(string fi /// When set to true, the response contains an array of groups that have visibility to the product. The default is false. /// Products which are part of a specific tag. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementProductProductRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementProductProductRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _apiManagementProductProductClientDiagnostics, Pipeline, "ApiManagementProductCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceProductProductRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceProductProductRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip, expandGroups, tags); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _serviceProductProductClientDiagnostics, Pipeline, "ServiceProductCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -285,11 +285,11 @@ public virtual async Task> ExistsAsync(string productId, Cancella { Argument.AssertNotNullOrEmpty(productId, nameof(productId)); - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductCollection.Exists"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductCollection.Exists"); scope.Start(); try { - var response = await _apiManagementProductProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceProductProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -320,11 +320,11 @@ public virtual Response Exists(string productId, CancellationToken cancell { Argument.AssertNotNullOrEmpty(productId, nameof(productId)); - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductCollection.Exists"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductCollection.Exists"); scope.Start(); try { - var response = _apiManagementProductProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken: cancellationToken); + var response = _serviceProductProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, productId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -334,7 +334,7 @@ public virtual Response Exists(string productId, CancellationToken cancell } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -344,7 +344,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductGroupLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductGroupLinkCollection.cs new file mode 100644 index 000000000000..0d3667df3ef0 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductGroupLinkCollection.cs @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceProductGroupLinks method from an instance of . + /// + public partial class ServiceProductGroupLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceProductGroupLinkProductGroupLinkClientDiagnostics; + private readonly ProductGroupLinkRestOperations _serviceProductGroupLinkProductGroupLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceProductGroupLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceProductGroupLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceProductGroupLinkProductGroupLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceProductGroupLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceProductGroupLinkResource.ResourceType, out string serviceProductGroupLinkProductGroupLinkApiVersion); + _serviceProductGroupLinkProductGroupLinkRestClient = new ProductGroupLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceProductGroupLinkProductGroupLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceProductResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceProductResource.ResourceType), nameof(id)); + } + + /// + /// Adds a group to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string groupLinkId, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceProductGroupLinkProductGroupLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductGroupLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a group to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string groupLinkId, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceProductGroupLinkProductGroupLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductGroupLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceProductGroupLinkProductGroupLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceProductGroupLinkProductGroupLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the group links associated with a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks + /// + /// + /// Operation Id + /// ProductGroupLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceProductGroupLinkProductGroupLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceProductGroupLinkProductGroupLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceProductGroupLinkResource(Client, ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(e)), _serviceProductGroupLinkProductGroupLinkClientDiagnostics, Pipeline, "ServiceProductGroupLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the group links associated with a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks + /// + /// + /// Operation Id + /// ProductGroupLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceProductGroupLinkProductGroupLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceProductGroupLinkProductGroupLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceProductGroupLinkResource(Client, ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(e)), _serviceProductGroupLinkProductGroupLinkClientDiagnostics, Pipeline, "ServiceProductGroupLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceProductGroupLinkProductGroupLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceProductGroupLinkProductGroupLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductGroupLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductGroupLinkResource.cs new file mode 100644 index 000000000000..09840ad4bc35 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductGroupLinkResource.cs @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceProductGroupLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceProductGroupLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceProductGroupLink method. + /// + public partial class ServiceProductGroupLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string productId, string groupLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceProductGroupLinkProductGroupLinkClientDiagnostics; + private readonly ProductGroupLinkRestOperations _serviceProductGroupLinkProductGroupLinkRestClient; + private readonly ProductGroupLinkContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceProductGroupLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceProductGroupLinkResource(ArmClient client, ProductGroupLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceProductGroupLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceProductGroupLinkProductGroupLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceProductGroupLinkProductGroupLinkApiVersion); + _serviceProductGroupLinkProductGroupLinkRestClient = new ProductGroupLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceProductGroupLinkProductGroupLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/products/groupLinks"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ProductGroupLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceProductGroupLinkProductGroupLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceProductGroupLinkProductGroupLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified group from the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceProductGroupLinkProductGroupLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified group from the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceProductGroupLinkProductGroupLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a group to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceProductGroupLinkProductGroupLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductGroupLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a group to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductGroupLinkProductGroupLinkClientDiagnostics.CreateScope("ServiceProductGroupLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceProductGroupLinkProductGroupLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductGroupLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductResource.cs similarity index 72% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductResource.cs index 938ddf58678b..38f421d9542e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductResource.cs @@ -18,22 +18,22 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an ApiManagementProduct along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiManagementProductResource method. - /// Otherwise you can get one from its parent resource using the GetApiManagementProduct method. + /// A Class representing a ServiceProduct along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceProductResource method. + /// Otherwise you can get one from its parent resource using the GetServiceProduct method. /// - public partial class ApiManagementProductResource : ArmResource + public partial class ServiceProductResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string productId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}"; return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiManagementProductProductClientDiagnostics; - private readonly ProductRestOperations _apiManagementProductProductRestClient; + private readonly ClientDiagnostics _serviceProductProductClientDiagnostics; + private readonly ProductRestOperations _serviceProductProductRestClient; private readonly ClientDiagnostics _productApiClientDiagnostics; private readonly ProductApiRestOperations _productApiRestClient; private readonly ClientDiagnostics _productGroupClientDiagnostics; @@ -42,28 +42,28 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly ProductSubscriptionsRestOperations _productSubscriptionsRestClient; private readonly ApiManagementProductData _data; - /// Initializes a new instance of the class for mocking. - protected ApiManagementProductResource() + /// Initializes a new instance of the class for mocking. + protected ServiceProductResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiManagementProductResource(ArmClient client, ApiManagementProductData data) : this(client, data.Id) + internal ServiceProductResource(ArmClient client, ApiManagementProductData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiManagementProductResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceProductResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementProductProductClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiManagementProductProductApiVersion); - _apiManagementProductProductRestClient = new ProductRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementProductProductApiVersion); + _serviceProductProductClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceProductProductApiVersion); + _serviceProductProductRestClient = new ProductRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceProductProductApiVersion); _productApiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); _productApiRestClient = new ProductApiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _productGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); @@ -99,7 +99,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } - /// Gets a collection of ApiManagementProductPolicyResources in the ApiManagementProduct. + /// Gets a collection of ApiManagementProductPolicyResources in the ServiceProduct. /// An object representing collection of ApiManagementProductPolicyResources and their operations over a ApiManagementProductPolicyResource. public virtual ApiManagementProductPolicyCollection GetApiManagementProductPolicies() { @@ -150,7 +150,7 @@ public virtual Response GetApiManagementProd return GetApiManagementProductPolicies().Get(policyId, format, cancellationToken); } - /// Gets a collection of ApiManagementProductTagResources in the ApiManagementProduct. + /// Gets a collection of ApiManagementProductTagResources in the ServiceProduct. /// An object representing collection of ApiManagementProductTagResources and their operations over a ApiManagementProductTagResource. public virtual ApiManagementProductTagCollection GetApiManagementProductTags() { @@ -203,6 +203,119 @@ public virtual Response GetApiManagementProduct return GetApiManagementProductTags().Get(tagId, cancellationToken); } + /// Gets an object representing a ServiceProductWikiResource along with the instance operations that can be performed on it in the ServiceProduct. + /// Returns a object. + public virtual ServiceProductWikiResource GetServiceProductWiki() + { + return new ServiceProductWikiResource(Client, Id.AppendChildResource("wikis", "default")); + } + + /// Gets a collection of ServiceProductApiLinkResources in the ServiceProduct. + /// An object representing collection of ServiceProductApiLinkResources and their operations over a ServiceProductApiLinkResource. + public virtual ServiceProductApiLinkCollection GetServiceProductApiLinks() + { + return GetCachedClient(Client => new ServiceProductApiLinkCollection(Client, Id)); + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceProductApiLinkAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceProductApiLinks().GetAsync(apiLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// ProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceProductApiLink(string apiLinkId, CancellationToken cancellationToken = default) + { + return GetServiceProductApiLinks().Get(apiLinkId, cancellationToken); + } + + /// Gets a collection of ServiceProductGroupLinkResources in the ServiceProduct. + /// An object representing collection of ServiceProductGroupLinkResources and their operations over a ServiceProductGroupLinkResource. + public virtual ServiceProductGroupLinkCollection GetServiceProductGroupLinks() + { + return GetCachedClient(Client => new ServiceProductGroupLinkCollection(Client, Id)); + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceProductGroupLinkAsync(string groupLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceProductGroupLinks().GetAsync(groupLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// ProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceProductGroupLink(string groupLinkId, CancellationToken cancellationToken = default) + { + return GetServiceProductGroupLinks().Get(groupLinkId, cancellationToken); + } + /// /// Gets the details of the product specified by its identifier. /// @@ -217,16 +330,16 @@ public virtual Response GetApiManagementProduct /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductResource.Get"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductResource.Get"); scope.Start(); try { - var response = await _apiManagementProductProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceProductProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementProductResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceProductResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -249,16 +362,16 @@ public virtual async Task> GetAsync(Cance /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductResource.Get"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductResource.Get"); scope.Start(); try { - var response = _apiManagementProductProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceProductProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementProductResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceProductResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -286,11 +399,11 @@ public virtual Response Get(CancellationToken canc /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, bool? deleteSubscriptions = null, CancellationToken cancellationToken = default) { - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductResource.Delete"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductResource.Delete"); scope.Start(); try { - var response = await _apiManagementProductProductRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteSubscriptions, cancellationToken).ConfigureAwait(false); + var response = await _serviceProductProductRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteSubscriptions, cancellationToken).ConfigureAwait(false); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -322,11 +435,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag if /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, bool? deleteSubscriptions = null, CancellationToken cancellationToken = default) { - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductResource.Delete"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductResource.Delete"); scope.Start(); try { - var response = _apiManagementProductProductRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteSubscriptions, cancellationToken); + var response = _serviceProductProductRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, deleteSubscriptions, cancellationToken); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); @@ -353,19 +466,19 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, bool? dele /// /// /// 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. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(ETag ifMatch, ApiManagementProductPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, ProductUpdateParameters productUpdateParameters, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(productUpdateParameters, nameof(productUpdateParameters)); - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductResource.Update"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductResource.Update"); scope.Start(); try { - var response = await _apiManagementProductProductRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ApiManagementProductResource(Client, response.Value), response.GetRawResponse()); + var response = await _serviceProductProductRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, productUpdateParameters, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceProductResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -388,19 +501,19 @@ public virtual async Task> UpdateAsync(ET /// /// /// 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. - /// Update parameters. + /// Update parameters. /// The cancellation token to use. - /// is null. - public virtual Response Update(ETag ifMatch, ApiManagementProductPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(ETag ifMatch, ProductUpdateParameters productUpdateParameters, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(productUpdateParameters, nameof(productUpdateParameters)); - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductResource.Update"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductResource.Update"); scope.Start(); try { - var response = _apiManagementProductProductRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, patch, cancellationToken); - return Response.FromValue(new ApiManagementProductResource(Client, response.Value), response.GetRawResponse()); + var response = _serviceProductProductRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, productUpdateParameters, cancellationToken); + return Response.FromValue(new ServiceProductResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -431,7 +544,7 @@ public virtual AsyncPageable GetProductApisAsync(string filter = { HttpMessage FirstPageRequest(int? pageSizeHint) => _productApiRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _productApiRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProductApiData.DeserializeProductApiData, _productApiClientDiagnostics, Pipeline, "ApiManagementProductResource.GetProductApis", "value", "nextLink", cancellationToken); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProductApiData.DeserializeProductApiData, _productApiClientDiagnostics, Pipeline, "ServiceProductResource.GetProductApis", "value", "nextLink", cancellationToken); } /// @@ -456,7 +569,7 @@ public virtual Pageable GetProductApis(string filter = null, int { HttpMessage FirstPageRequest(int? pageSizeHint) => _productApiRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _productApiRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProductApiData.DeserializeProductApiData, _productApiClientDiagnostics, Pipeline, "ApiManagementProductResource.GetProductApis", "value", "nextLink", cancellationToken); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProductApiData.DeserializeProductApiData, _productApiClientDiagnostics, Pipeline, "ServiceProductResource.GetProductApis", "value", "nextLink", cancellationToken); } /// @@ -480,7 +593,7 @@ public virtual async Task> CheckProductApiEntityExistsAsync(strin { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _productApiClientDiagnostics.CreateScope("ApiManagementProductResource.CheckProductApiEntityExists"); + using var scope = _productApiClientDiagnostics.CreateScope("ServiceProductResource.CheckProductApiEntityExists"); scope.Start(); try { @@ -515,7 +628,7 @@ public virtual Response CheckProductApiEntityExists(string apiId, Cancella { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _productApiClientDiagnostics.CreateScope("ApiManagementProductResource.CheckProductApiEntityExists"); + using var scope = _productApiClientDiagnostics.CreateScope("ServiceProductResource.CheckProductApiEntityExists"); scope.Start(); try { @@ -550,7 +663,7 @@ public virtual async Task> CreateOrUpdateProductApiAsyn { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _productApiClientDiagnostics.CreateScope("ApiManagementProductResource.CreateOrUpdateProductApi"); + using var scope = _productApiClientDiagnostics.CreateScope("ServiceProductResource.CreateOrUpdateProductApi"); scope.Start(); try { @@ -585,7 +698,7 @@ public virtual Response CreateOrUpdateProductApi(string apiId, C { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _productApiClientDiagnostics.CreateScope("ApiManagementProductResource.CreateOrUpdateProductApi"); + using var scope = _productApiClientDiagnostics.CreateScope("ServiceProductResource.CreateOrUpdateProductApi"); scope.Start(); try { @@ -620,7 +733,7 @@ public virtual async Task DeleteProductApiAsync(string apiId, Cancella { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _productApiClientDiagnostics.CreateScope("ApiManagementProductResource.DeleteProductApi"); + using var scope = _productApiClientDiagnostics.CreateScope("ServiceProductResource.DeleteProductApi"); scope.Start(); try { @@ -655,7 +768,7 @@ public virtual Response DeleteProductApi(string apiId, CancellationToken cancell { Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); - using var scope = _productApiClientDiagnostics.CreateScope("ApiManagementProductResource.DeleteProductApi"); + using var scope = _productApiClientDiagnostics.CreateScope("ServiceProductResource.DeleteProductApi"); scope.Start(); try { @@ -691,7 +804,7 @@ public virtual AsyncPageable GetProductGroupsAsync(string filt { HttpMessage FirstPageRequest(int? pageSizeHint) => _productGroupRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _productGroupRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProductGroupData.DeserializeProductGroupData, _productGroupClientDiagnostics, Pipeline, "ApiManagementProductResource.GetProductGroups", "value", "nextLink", cancellationToken); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProductGroupData.DeserializeProductGroupData, _productGroupClientDiagnostics, Pipeline, "ServiceProductResource.GetProductGroups", "value", "nextLink", cancellationToken); } /// @@ -716,7 +829,7 @@ public virtual Pageable GetProductGroups(string filter = null, { HttpMessage FirstPageRequest(int? pageSizeHint) => _productGroupRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _productGroupRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProductGroupData.DeserializeProductGroupData, _productGroupClientDiagnostics, Pipeline, "ApiManagementProductResource.GetProductGroups", "value", "nextLink", cancellationToken); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProductGroupData.DeserializeProductGroupData, _productGroupClientDiagnostics, Pipeline, "ServiceProductResource.GetProductGroups", "value", "nextLink", cancellationToken); } /// @@ -740,7 +853,7 @@ public virtual async Task> CheckProductGroupEntityExistsAsync(str { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _productGroupClientDiagnostics.CreateScope("ApiManagementProductResource.CheckProductGroupEntityExists"); + using var scope = _productGroupClientDiagnostics.CreateScope("ServiceProductResource.CheckProductGroupEntityExists"); scope.Start(); try { @@ -775,7 +888,7 @@ public virtual Response CheckProductGroupEntityExists(string groupId, Canc { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _productGroupClientDiagnostics.CreateScope("ApiManagementProductResource.CheckProductGroupEntityExists"); + using var scope = _productGroupClientDiagnostics.CreateScope("ServiceProductResource.CheckProductGroupEntityExists"); scope.Start(); try { @@ -810,7 +923,7 @@ public virtual async Task> CreateOrUpdateProductGroup { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _productGroupClientDiagnostics.CreateScope("ApiManagementProductResource.CreateOrUpdateProductGroup"); + using var scope = _productGroupClientDiagnostics.CreateScope("ServiceProductResource.CreateOrUpdateProductGroup"); scope.Start(); try { @@ -845,7 +958,7 @@ public virtual Response CreateOrUpdateProductGroup(string grou { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _productGroupClientDiagnostics.CreateScope("ApiManagementProductResource.CreateOrUpdateProductGroup"); + using var scope = _productGroupClientDiagnostics.CreateScope("ServiceProductResource.CreateOrUpdateProductGroup"); scope.Start(); try { @@ -880,7 +993,7 @@ public virtual async Task DeleteProductGroupAsync(string groupId, Canc { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _productGroupClientDiagnostics.CreateScope("ApiManagementProductResource.DeleteProductGroup"); + using var scope = _productGroupClientDiagnostics.CreateScope("ServiceProductResource.DeleteProductGroup"); scope.Start(); try { @@ -915,7 +1028,7 @@ public virtual Response DeleteProductGroup(string groupId, CancellationToken can { Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); - using var scope = _productGroupClientDiagnostics.CreateScope("ApiManagementProductResource.DeleteProductGroup"); + using var scope = _productGroupClientDiagnostics.CreateScope("ServiceProductResource.DeleteProductGroup"); scope.Start(); try { @@ -929,6 +1042,56 @@ public virtual Response DeleteProductGroup(string groupId, CancellationToken can } } + /// + /// Lists the collection of subscriptions to the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/subscriptions + /// + /// + /// Operation Id + /// ProductSubscriptions_List + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllProductSubscriptionDataAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _productSubscriptionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _productSubscriptionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SubscriptionContractData.DeserializeSubscriptionContractData, _productSubscriptionsClientDiagnostics, Pipeline, "ServiceProductResource.GetAllProductSubscriptionData", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the collection of subscriptions to the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/subscriptions + /// + /// + /// Operation Id + /// ProductSubscriptions_List + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAllProductSubscriptionData(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _productSubscriptionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _productSubscriptionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SubscriptionContractData.DeserializeSubscriptionContractData, _productSubscriptionsClientDiagnostics, Pipeline, "ServiceProductResource.GetAllProductSubscriptionData", "value", "nextLink", cancellationToken); + } + /// /// Gets the entity state (Etag) version of the product specified by its identifier. /// @@ -945,11 +1108,11 @@ public virtual Response DeleteProductGroup(string groupId, CancellationToken can /// The cancellation token to use. public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductResource.GetEntityTag"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductResource.GetEntityTag"); scope.Start(); try { - var response = await _apiManagementProductProductRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceProductProductRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -975,11 +1138,11 @@ public virtual async Task> GetEntityTagAsync(CancellationToken ca /// The cancellation token to use. public virtual Response GetEntityTag(CancellationToken cancellationToken = default) { - using var scope = _apiManagementProductProductClientDiagnostics.CreateScope("ApiManagementProductResource.GetEntityTag"); + using var scope = _serviceProductProductClientDiagnostics.CreateScope("ServiceProductResource.GetEntityTag"); scope.Start(); try { - var response = _apiManagementProductProductRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceProductProductRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductWikiResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductWikiResource.cs new file mode 100644 index 000000000000..51de30a6b7ea --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceProductWikiResource.cs @@ -0,0 +1,432 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceProductWiki along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceProductWikiResource method. + /// Otherwise you can get one from its parent resource using the GetServiceProductWiki method. + /// + public partial class ServiceProductWikiResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string productId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceProductWikiProductWikiClientDiagnostics; + private readonly ProductWikiRestOperations _serviceProductWikiProductWikiRestClient; + private readonly WikiContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceProductWikiResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceProductWikiResource(ArmClient client, WikiContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceProductWikiResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceProductWikiProductWikiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceProductWikiProductWikiApiVersion); + _serviceProductWikiProductWikiRestClient = new ProductWikiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceProductWikiProductWikiApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/products/wikis"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual WikiContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the Wiki for a Product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.Get"); + scope.Start(); + try + { + var response = await _serviceProductWikiProductWikiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductWikiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Wiki for a Product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.Get"); + scope.Start(); + try + { + var response = _serviceProductWikiProductWikiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceProductWikiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified Wiki from a Product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.Delete"); + scope.Start(); + try + { + var response = await _serviceProductWikiProductWikiRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified Wiki from a Product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.Delete"); + scope.Start(); + try + { + var response = _serviceProductWikiProductWikiRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the Wiki for a Product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_Update + /// + /// + /// + /// 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. + /// Wiki Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, WikiUpdateContract wikiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(wikiUpdateContract, nameof(wikiUpdateContract)); + + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.Update"); + scope.Start(); + try + { + var response = await _serviceProductWikiProductWikiRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, ifMatch, wikiUpdateContract, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceProductWikiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the Wiki for a Product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_Update + /// + /// + /// + /// 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. + /// Wiki Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, WikiUpdateContract wikiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(wikiUpdateContract, nameof(wikiUpdateContract)); + + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.Update"); + scope.Start(); + try + { + var response = _serviceProductWikiProductWikiRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, ifMatch, wikiUpdateContract, cancellationToken); + return Response.FromValue(new ServiceProductWikiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new Wiki for a Product or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, WikiContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceProductWikiProductWikiRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductWikiResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new Wiki for a Product or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, WikiContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceProductWikiProductWikiRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceProductWikiResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Wiki for a Product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceProductWikiProductWikiRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Wiki for a Product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/wikis/default + /// + /// + /// Operation Id + /// ProductWiki_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceProductWikiProductWikiClientDiagnostics.CreateScope("ServiceProductWikiResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceProductWikiProductWikiRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceSchemaCollection.cs similarity index 65% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaCollection.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceSchemaCollection.cs index f9a31db5737d..0764f5b993d8 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaCollection.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceSchemaCollection.cs @@ -19,28 +19,28 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetApiManagementGlobalSchemas method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceSchemas method from an instance of . /// - public partial class ApiManagementGlobalSchemaCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ServiceSchemaCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics; - private readonly GlobalSchemaRestOperations _apiManagementGlobalSchemaGlobalSchemaRestClient; + private readonly ClientDiagnostics _serviceSchemaGlobalSchemaClientDiagnostics; + private readonly GlobalSchemaRestOperations _serviceSchemaGlobalSchemaRestClient; - /// Initializes a new instance of the class for mocking. - protected ApiManagementGlobalSchemaCollection() + /// Initializes a new instance of the class for mocking. + protected ServiceSchemaCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal ApiManagementGlobalSchemaCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceSchemaCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiManagementGlobalSchemaResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ApiManagementGlobalSchemaResource.ResourceType, out string apiManagementGlobalSchemaGlobalSchemaApiVersion); - _apiManagementGlobalSchemaGlobalSchemaRestClient = new GlobalSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementGlobalSchemaGlobalSchemaApiVersion); + _serviceSchemaGlobalSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceSchemaResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceSchemaResource.ResourceType, out string serviceSchemaGlobalSchemaApiVersion); + _serviceSchemaGlobalSchemaRestClient = new GlobalSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceSchemaGlobalSchemaApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -72,17 +72,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string schemaId, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string schemaId, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaCollection.CreateOrUpdate"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, data, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(new ApiManagementGlobalSchemaOperationSource(Client), _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics, Pipeline, _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = await _serviceSchemaGlobalSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceSchemaOperationSource(Client), _serviceSchemaGlobalSchemaClientDiagnostics, Pipeline, _serviceSchemaGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -114,17 +114,17 @@ public virtual async Task> Creat /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string schemaId, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string schemaId, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaCollection.CreateOrUpdate"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaCollection.CreateOrUpdate"); scope.Start(); try { - var response = _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, data, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(new ApiManagementGlobalSchemaOperationSource(Client), _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics, Pipeline, _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = _serviceSchemaGlobalSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceSchemaOperationSource(Client), _serviceSchemaGlobalSchemaClientDiagnostics, Pipeline, _serviceSchemaGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -153,18 +153,18 @@ public virtual ArmOperation CreateOrUpdate(Wa /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string schemaId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string schemaId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaCollection.Get"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaCollection.Get"); scope.Start(); try { - var response = await _apiManagementGlobalSchemaGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken).ConfigureAwait(false); + var response = await _serviceSchemaGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGlobalSchemaResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -190,18 +190,18 @@ public virtual async Task> GetAsync( /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string schemaId, CancellationToken cancellationToken = default) + public virtual Response Get(string schemaId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaCollection.Get"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaCollection.Get"); scope.Start(); try { - var response = _apiManagementGlobalSchemaGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken); + var response = _serviceSchemaGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGlobalSchemaResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -227,12 +227,12 @@ public virtual Response Get(string schemaId, /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGlobalSchemaResource(Client, ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(e)), _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics, Pipeline, "ApiManagementGlobalSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceSchemaGlobalSchemaRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceSchemaGlobalSchemaRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceSchemaResource(Client, ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(e)), _serviceSchemaGlobalSchemaClientDiagnostics, Pipeline, "ServiceSchemaCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -252,12 +252,12 @@ public virtual AsyncPageable GetAllAsync(stri /// Number of records to return. /// Number of records to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementGlobalSchemaResource(Client, ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(e)), _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics, Pipeline, "ApiManagementGlobalSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceSchemaGlobalSchemaRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceSchemaGlobalSchemaRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceSchemaResource(Client, ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(e)), _serviceSchemaGlobalSchemaClientDiagnostics, Pipeline, "ServiceSchemaCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -281,11 +281,11 @@ public virtual async Task> ExistsAsync(string schemaId, Cancellat { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaCollection.Exists"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaCollection.Exists"); scope.Start(); try { - var response = await _apiManagementGlobalSchemaGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _serviceSchemaGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -316,11 +316,11 @@ public virtual Response Exists(string schemaId, CancellationToken cancella { Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaCollection.Exists"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaCollection.Exists"); scope.Start(); try { - var response = _apiManagementGlobalSchemaGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken: cancellationToken); + var response = _serviceSchemaGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, schemaId, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -330,7 +330,7 @@ public virtual Response Exists(string schemaId, CancellationToken cancella } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -340,7 +340,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceSchemaResource.cs similarity index 70% rename from sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaResource.cs rename to sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceSchemaResource.cs index 895e1e2f6916..691dd5f2e9ca 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceSchemaResource.cs @@ -17,46 +17,46 @@ namespace Azure.ResourceManager.ApiManagement { /// - /// A Class representing an ApiManagementGlobalSchema along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetApiManagementGlobalSchemaResource method. - /// Otherwise you can get one from its parent resource using the GetApiManagementGlobalSchema method. + /// A Class representing a ServiceSchema along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceSchemaResource method. + /// Otherwise you can get one from its parent resource using the GetServiceSchema method. /// - public partial class ApiManagementGlobalSchemaResource : ArmResource + public partial class ServiceSchemaResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string schemaId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}"; return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics; - private readonly GlobalSchemaRestOperations _apiManagementGlobalSchemaGlobalSchemaRestClient; + private readonly ClientDiagnostics _serviceSchemaGlobalSchemaClientDiagnostics; + private readonly GlobalSchemaRestOperations _serviceSchemaGlobalSchemaRestClient; private readonly ApiManagementGlobalSchemaData _data; - /// Initializes a new instance of the class for mocking. - protected ApiManagementGlobalSchemaResource() + /// Initializes a new instance of the class for mocking. + protected ServiceSchemaResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal ApiManagementGlobalSchemaResource(ArmClient client, ApiManagementGlobalSchemaData data) : this(client, data.Id) + internal ServiceSchemaResource(ArmClient client, ApiManagementGlobalSchemaData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal ApiManagementGlobalSchemaResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ServiceSchemaResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string apiManagementGlobalSchemaGlobalSchemaApiVersion); - _apiManagementGlobalSchemaGlobalSchemaRestClient = new GlobalSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, apiManagementGlobalSchemaGlobalSchemaApiVersion); + _serviceSchemaGlobalSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceSchemaGlobalSchemaApiVersion); + _serviceSchemaGlobalSchemaRestClient = new GlobalSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceSchemaGlobalSchemaApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -100,16 +100,16 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaResource.Get"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaResource.Get"); scope.Start(); try { - var response = await _apiManagementGlobalSchemaGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceSchemaGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGlobalSchemaResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -132,16 +132,16 @@ public virtual async Task> GetAsync( /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaResource.Get"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaResource.Get"); scope.Start(); try { - var response = _apiManagementGlobalSchemaGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceSchemaGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ApiManagementGlobalSchemaResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ServiceSchemaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -168,11 +168,11 @@ public virtual Response Get(CancellationToken /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaResource.Delete"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaResource.Delete"); scope.Start(); try { - var response = await _apiManagementGlobalSchemaGlobalSchemaRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var response = await _serviceSchemaGlobalSchemaRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -203,11 +203,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag if /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) { - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaResource.Delete"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaResource.Delete"); scope.Start(); try { - var response = _apiManagementGlobalSchemaGlobalSchemaRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var response = _serviceSchemaGlobalSchemaRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); var operation = new ApiManagementArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); @@ -238,16 +238,16 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, Cancellati /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaResource.Update"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaResource.Update"); scope.Start(); try { - var response = await _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); - var operation = new ApiManagementArmOperation(new ApiManagementGlobalSchemaOperationSource(Client), _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics, Pipeline, _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = await _serviceSchemaGlobalSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceSchemaOperationSource(Client), _serviceSchemaGlobalSchemaClientDiagnostics, Pipeline, _serviceSchemaGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -277,16 +277,16 @@ public virtual async Task> Updat /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaResource.Update"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaResource.Update"); scope.Start(); try { - var response = _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); - var operation = new ApiManagementArmOperation(new ApiManagementGlobalSchemaOperationSource(Client), _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics, Pipeline, _apiManagementGlobalSchemaGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + var response = _serviceSchemaGlobalSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceSchemaOperationSource(Client), _serviceSchemaGlobalSchemaClientDiagnostics, Pipeline, _serviceSchemaGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -314,11 +314,11 @@ public virtual ArmOperation Update(WaitUntil /// The cancellation token to use. public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) { - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaResource.GetEntityTag"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaResource.GetEntityTag"); scope.Start(); try { - var response = await _apiManagementGlobalSchemaGlobalSchemaRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _serviceSchemaGlobalSchemaRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -344,11 +344,11 @@ public virtual async Task> GetEntityTagAsync(CancellationToken ca /// The cancellation token to use. public virtual Response GetEntityTag(CancellationToken cancellationToken = default) { - using var scope = _apiManagementGlobalSchemaGlobalSchemaClientDiagnostics.CreateScope("ApiManagementGlobalSchemaResource.GetEntityTag"); + using var scope = _serviceSchemaGlobalSchemaClientDiagnostics.CreateScope("ServiceSchemaResource.GetEntityTag"); scope.Start(); try { - var response = _apiManagementGlobalSchemaGlobalSchemaRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _serviceSchemaGlobalSchemaRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagApiLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagApiLinkCollection.cs new file mode 100644 index 000000000000..064017390886 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagApiLinkCollection.cs @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceTagApiLinks method from an instance of . + /// + public partial class ServiceTagApiLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceTagApiLinkTagApiLinkClientDiagnostics; + private readonly TagApiLinkRestOperations _serviceTagApiLinkTagApiLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceTagApiLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceTagApiLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceTagApiLinkTagApiLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceTagApiLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceTagApiLinkResource.ResourceType, out string serviceTagApiLinkTagApiLinkApiVersion); + _serviceTagApiLinkTagApiLinkRestClient = new TagApiLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceTagApiLinkTagApiLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ApiManagementTagResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementTagResource.ResourceType), nameof(id)); + } + + /// + /// Adds an API to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string apiLinkId, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceTagApiLinkTagApiLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string apiLinkId, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceTagApiLinkTagApiLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceTagApiLinkTagApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceTagApiLinkTagApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the API links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks + /// + /// + /// Operation Id + /// TagApiLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceTagApiLinkTagApiLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceTagApiLinkTagApiLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceTagApiLinkResource(Client, TagApiLinkContractData.DeserializeTagApiLinkContractData(e)), _serviceTagApiLinkTagApiLinkClientDiagnostics, Pipeline, "ServiceTagApiLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the API links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks + /// + /// + /// Operation Id + /// TagApiLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceTagApiLinkTagApiLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceTagApiLinkTagApiLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceTagApiLinkResource(Client, TagApiLinkContractData.DeserializeTagApiLinkContractData(e)), _serviceTagApiLinkTagApiLinkClientDiagnostics, Pipeline, "ServiceTagApiLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceTagApiLinkTagApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceTagApiLinkTagApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagApiLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagApiLinkResource.cs new file mode 100644 index 000000000000..25e52075edd0 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagApiLinkResource.cs @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceTagApiLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceTagApiLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceTagApiLink method. + /// + public partial class ServiceTagApiLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string apiLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceTagApiLinkTagApiLinkClientDiagnostics; + private readonly TagApiLinkRestOperations _serviceTagApiLinkTagApiLinkRestClient; + private readonly TagApiLinkContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceTagApiLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceTagApiLinkResource(ArmClient client, TagApiLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceTagApiLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceTagApiLinkTagApiLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceTagApiLinkTagApiLinkApiVersion); + _serviceTagApiLinkTagApiLinkRestClient = new TagApiLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceTagApiLinkTagApiLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/tags/apiLinks"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual TagApiLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceTagApiLinkTagApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceTagApiLinkTagApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceTagApiLinkTagApiLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceTagApiLinkTagApiLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceTagApiLinkTagApiLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// TagApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagApiLinkTagApiLinkClientDiagnostics.CreateScope("ServiceTagApiLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceTagApiLinkTagApiLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagOperationLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagOperationLinkCollection.cs new file mode 100644 index 000000000000..05539dac78d7 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagOperationLinkCollection.cs @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceTagOperationLinks method from an instance of . + /// + public partial class ServiceTagOperationLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceTagOperationLinkTagOperationLinkClientDiagnostics; + private readonly TagOperationLinkRestOperations _serviceTagOperationLinkTagOperationLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceTagOperationLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceTagOperationLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceTagOperationLinkTagOperationLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceTagOperationLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceTagOperationLinkResource.ResourceType, out string serviceTagOperationLinkTagOperationLinkApiVersion); + _serviceTagOperationLinkTagOperationLinkRestClient = new TagOperationLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceTagOperationLinkTagOperationLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ApiManagementTagResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementTagResource.ResourceType), nameof(id)); + } + + /// + /// Adds an operation to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string operationLinkId, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceTagOperationLinkTagOperationLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagOperationLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an operation to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string operationLinkId, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceTagOperationLinkTagOperationLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagOperationLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceTagOperationLinkTagOperationLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceTagOperationLinkTagOperationLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the operation links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks + /// + /// + /// Operation Id + /// TagOperationLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceTagOperationLinkTagOperationLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceTagOperationLinkTagOperationLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceTagOperationLinkResource(Client, TagOperationLinkContractData.DeserializeTagOperationLinkContractData(e)), _serviceTagOperationLinkTagOperationLinkClientDiagnostics, Pipeline, "ServiceTagOperationLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the operation links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks + /// + /// + /// Operation Id + /// TagOperationLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceTagOperationLinkTagOperationLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceTagOperationLinkTagOperationLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceTagOperationLinkResource(Client, TagOperationLinkContractData.DeserializeTagOperationLinkContractData(e)), _serviceTagOperationLinkTagOperationLinkClientDiagnostics, Pipeline, "ServiceTagOperationLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceTagOperationLinkTagOperationLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceTagOperationLinkTagOperationLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagOperationLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagOperationLinkResource.cs new file mode 100644 index 000000000000..a03a32cd2b3d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagOperationLinkResource.cs @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceTagOperationLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceTagOperationLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceTagOperationLink method. + /// + public partial class ServiceTagOperationLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string operationLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceTagOperationLinkTagOperationLinkClientDiagnostics; + private readonly TagOperationLinkRestOperations _serviceTagOperationLinkTagOperationLinkRestClient; + private readonly TagOperationLinkContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceTagOperationLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceTagOperationLinkResource(ArmClient client, TagOperationLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceTagOperationLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceTagOperationLinkTagOperationLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceTagOperationLinkTagOperationLinkApiVersion); + _serviceTagOperationLinkTagOperationLinkRestClient = new TagOperationLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceTagOperationLinkTagOperationLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/tags/operationLinks"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual TagOperationLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceTagOperationLinkTagOperationLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceTagOperationLinkTagOperationLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified operation from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceTagOperationLinkTagOperationLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified operation from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceTagOperationLinkTagOperationLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an operation to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceTagOperationLinkTagOperationLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagOperationLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an operation to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// TagOperationLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagOperationLinkTagOperationLinkClientDiagnostics.CreateScope("ServiceTagOperationLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceTagOperationLinkTagOperationLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagOperationLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagProductLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagProductLinkCollection.cs new file mode 100644 index 000000000000..27d5d19bdad9 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagProductLinkCollection.cs @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceTagProductLinks method from an instance of . + /// + public partial class ServiceTagProductLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceTagProductLinkTagProductLinkClientDiagnostics; + private readonly TagProductLinkRestOperations _serviceTagProductLinkTagProductLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceTagProductLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceTagProductLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceTagProductLinkTagProductLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceTagProductLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceTagProductLinkResource.ResourceType, out string serviceTagProductLinkTagProductLinkApiVersion); + _serviceTagProductLinkTagProductLinkRestClient = new TagProductLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceTagProductLinkTagProductLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ApiManagementTagResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementTagResource.ResourceType), nameof(id)); + } + + /// + /// Adds a product to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string productLinkId, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceTagProductLinkTagProductLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagProductLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a product to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string productLinkId, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceTagProductLinkTagProductLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagProductLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceTagProductLinkTagProductLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceTagProductLinkTagProductLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the product links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks + /// + /// + /// Operation Id + /// TagProductLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceTagProductLinkTagProductLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceTagProductLinkTagProductLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceTagProductLinkResource(Client, TagProductLinkContractData.DeserializeTagProductLinkContractData(e)), _serviceTagProductLinkTagProductLinkClientDiagnostics, Pipeline, "ServiceTagProductLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the product links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks + /// + /// + /// Operation Id + /// TagProductLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceTagProductLinkTagProductLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceTagProductLinkTagProductLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceTagProductLinkResource(Client, TagProductLinkContractData.DeserializeTagProductLinkContractData(e)), _serviceTagProductLinkTagProductLinkClientDiagnostics, Pipeline, "ServiceTagProductLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceTagProductLinkTagProductLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceTagProductLinkTagProductLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagProductLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagProductLinkResource.cs new file mode 100644 index 000000000000..722262835dfc --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceTagProductLinkResource.cs @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceTagProductLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceTagProductLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceTagProductLink method. + /// + public partial class ServiceTagProductLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string tagId, string productLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceTagProductLinkTagProductLinkClientDiagnostics; + private readonly TagProductLinkRestOperations _serviceTagProductLinkTagProductLinkRestClient; + private readonly TagProductLinkContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceTagProductLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceTagProductLinkResource(ArmClient client, TagProductLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceTagProductLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceTagProductLinkTagProductLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceTagProductLinkTagProductLinkApiVersion); + _serviceTagProductLinkTagProductLinkRestClient = new TagProductLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceTagProductLinkTagProductLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/tags/productLinks"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual TagProductLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceTagProductLinkTagProductLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceTagProductLinkTagProductLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified product from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceTagProductLinkTagProductLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified product from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceTagProductLinkTagProductLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a product to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceTagProductLinkTagProductLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagProductLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a product to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// TagProductLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceTagProductLinkTagProductLinkClientDiagnostics.CreateScope("ServiceTagProductLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceTagProductLinkTagProductLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceTagProductLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiCollection.cs new file mode 100644 index 000000000000..81502ce6e3f0 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiCollection.cs @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceApis method from an instance of . + /// + public partial class ServiceWorkspaceApiCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceApiWorkspaceApiClientDiagnostics; + private readonly WorkspaceApiRestOperations _serviceWorkspaceApiWorkspaceApiRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceApiCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiWorkspaceApiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceApiResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceApiResource.ResourceType, out string serviceWorkspaceApiWorkspaceApiApiVersion); + _serviceWorkspaceApiWorkspaceApiRestClient = new WorkspaceApiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiWorkspaceApiApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates new or updates existing specified API of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(apiCreateOrUpdateParameter, nameof(apiCreateOrUpdateParameter)); + + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiWorkspaceApiRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiId, apiCreateOrUpdateParameter, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceApiOperationSource(Client), _serviceWorkspaceApiWorkspaceApiClientDiagnostics, Pipeline, _serviceWorkspaceApiWorkspaceApiRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiId, apiCreateOrUpdateParameter, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates new or updates existing specified API of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string apiId, ApiCreateOrUpdateParameter apiCreateOrUpdateParameter, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + Argument.AssertNotNull(apiCreateOrUpdateParameter, nameof(apiCreateOrUpdateParameter)); + + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiWorkspaceApiRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiId, apiCreateOrUpdateParameter, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceApiOperationSource(Client), _serviceWorkspaceApiWorkspaceApiClientDiagnostics, Pipeline, _serviceWorkspaceApiWorkspaceApiRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiId, apiCreateOrUpdateParameter, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Get + /// + /// + /// + /// 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. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiWorkspaceApiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Get + /// + /// + /// + /// 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. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiWorkspaceApiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all APIs of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis + /// + /// + /// Operation Id + /// WorkspaceApi_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// Include full ApiVersionSet resource in response. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiWorkspaceApiRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags, expandApiVersionSet); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiWorkspaceApiRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags, expandApiVersionSet); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiResource(Client, ApiData.DeserializeApiData(e)), _serviceWorkspaceApiWorkspaceApiClientDiagnostics, Pipeline, "ServiceWorkspaceApiCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all APIs of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis + /// + /// + /// Operation Id + /// WorkspaceApi_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| serviceUrl | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| path | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| isCurrent | filter | eq, ne | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// Include full ApiVersionSet resource in response. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, string tags = null, bool? expandApiVersionSet = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiWorkspaceApiRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags, expandApiVersionSet); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiWorkspaceApiRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, tags, expandApiVersionSet); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiResource(Client, ApiData.DeserializeApiData(e)), _serviceWorkspaceApiWorkspaceApiClientDiagnostics, Pipeline, "ServiceWorkspaceApiCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Get + /// + /// + /// + /// 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. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiWorkspaceApiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Get + /// + /// + /// + /// 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. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string apiId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiId, nameof(apiId)); + + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiWorkspaceApiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, apiId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationCollection.cs new file mode 100644 index 000000000000..5b99127b464e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationCollection.cs @@ -0,0 +1,350 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceApiOperations method from an instance of . + /// + public partial class ServiceWorkspaceApiOperationCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics; + private readonly WorkspaceApiOperationRestOperations _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiOperationCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceApiOperationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceApiOperationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceApiOperationResource.ResourceType, out string serviceWorkspaceApiOperationWorkspaceApiOperationApiVersion); + _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient = new WorkspaceApiOperationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiOperationWorkspaceApiOperationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceApiResource.ResourceType), nameof(id)); + } + + /// + /// Creates a new operation in the API or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string operationId, ApiOperationData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiOperationResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new operation in the API or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string operationId, ApiOperationData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiOperationResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the API Operation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Get + /// + /// + /// + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the API Operation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Get + /// + /// + /// + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the operations for the specified API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations + /// + /// + /// Operation Id + /// WorkspaceApiOperation_ListByApi + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip, tags); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip, tags); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiOperationResource(Client, ApiOperationData.DeserializeApiOperationData(e)), _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics, Pipeline, "ServiceWorkspaceApiOperationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the operations for the specified API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations + /// + /// + /// Operation Id + /// WorkspaceApiOperation_ListByApi + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| method | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Include tags in the response. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, string tags = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip, tags); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip, tags); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiOperationResource(Client, ApiOperationData.DeserializeApiOperationData(e)), _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics, Pipeline, "ServiceWorkspaceApiOperationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Get + /// + /// + /// + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Get + /// + /// + /// + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationPolicyCollection.cs new file mode 100644 index 000000000000..a3426f0f4be6 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationPolicyCollection.cs @@ -0,0 +1,325 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceApiOperationPolicies method from an instance of . + /// + public partial class ServiceWorkspaceApiOperationPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics; + private readonly WorkspaceApiOperationPolicyRestOperations _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiOperationPolicyCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceApiOperationPolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceApiOperationPolicyResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceApiOperationPolicyResource.ResourceType, out string serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyApiVersion); + _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient = new WorkspaceApiOperationPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceApiOperationResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceApiOperationResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates policy configuration for the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiOperationPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiOperationPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the list of policy configuration at the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_ListByOperation + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.CreateListByOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ServiceWorkspaceApiOperationPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics, Pipeline, "ServiceWorkspaceApiOperationPolicyCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Get the list of policy configuration at the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_ListByOperation + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.CreateListByOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return PageableHelpers.CreatePageable(FirstPageRequest, null, e => new ServiceWorkspaceApiOperationPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics, Pipeline, "ServiceWorkspaceApiOperationPolicyCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> ExistsAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Exists(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationPolicyResource.cs new file mode 100644 index 000000000000..b37138c038ae --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationPolicyResource.cs @@ -0,0 +1,364 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceApiOperationPolicy along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceApiOperationPolicyResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceApiOperationPolicy method. + /// + public partial class ServiceWorkspaceApiOperationPolicyResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId, PolicyName policyId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics; + private readonly WorkspaceApiOperationPolicyRestOperations _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient; + private readonly PolicyContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiOperationPolicyResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceApiOperationPolicyResource(ArmClient client, PolicyContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceApiOperationPolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyApiVersion); + _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient = new WorkspaceApiOperationPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/apis/operations/policies"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PolicyContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get the policy configuration at the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the Api Operation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the Api Operation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiOperationPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiOperationPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the API operation policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the API operation policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationPolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationPolicyWorkspaceApiOperationPolicyRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationResource.cs new file mode 100644 index 000000000000..c0b24c07279f --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiOperationResource.cs @@ -0,0 +1,405 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceApiOperation along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceApiOperationResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceApiOperation method. + /// + public partial class ServiceWorkspaceApiOperationResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string operationId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics; + private readonly WorkspaceApiOperationRestOperations _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient; + private readonly ApiOperationData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiOperationResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceApiOperationResource(ArmClient client, ApiOperationData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceApiOperationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceApiOperationWorkspaceApiOperationApiVersion); + _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient = new WorkspaceApiOperationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiOperationWorkspaceApiOperationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/apis/operations"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiOperationData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of ServiceWorkspaceApiOperationPolicyResources in the ServiceWorkspaceApiOperation. + /// An object representing collection of ServiceWorkspaceApiOperationPolicyResources and their operations over a ServiceWorkspaceApiOperationPolicyResource. + public virtual ServiceWorkspaceApiOperationPolicyCollection GetServiceWorkspaceApiOperationPolicies() + { + return GetCachedClient(Client => new ServiceWorkspaceApiOperationPolicyCollection(Client, Id)); + } + + /// + /// Get the policy configuration at the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceApiOperationPolicyAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceApiOperationPolicies().GetAsync(policyId, format, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the policy configuration at the API Operation level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiOperationPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceApiOperationPolicy(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceApiOperationPolicies().Get(policyId, format, cancellationToken); + } + + /// + /// Gets the details of the API Operation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the API Operation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified operation in the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified operation in the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the operation in the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Update + /// + /// + /// + /// 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. + /// API Operation Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, OperationUpdateContract operationUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(operationUpdateContract, nameof(operationUpdateContract)); + + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, operationUpdateContract, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceWorkspaceApiOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the operation in the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Update + /// + /// + /// + /// 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. + /// API Operation Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, OperationUpdateContract operationUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(operationUpdateContract, nameof(operationUpdateContract)); + + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, operationUpdateContract, cancellationToken); + return Response.FromValue(new ServiceWorkspaceApiOperationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the API operation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the API operation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiOperationWorkspaceApiOperationClientDiagnostics.CreateScope("ServiceWorkspaceApiOperationResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiOperationWorkspaceApiOperationRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiPolicyCollection.cs new file mode 100644 index 000000000000..0daf180c190a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiPolicyCollection.cs @@ -0,0 +1,325 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceApiPolicies method from an instance of . + /// + public partial class ServiceWorkspaceApiPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics; + private readonly WorkspaceApiPolicyRestOperations _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiPolicyCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceApiPolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceApiPolicyResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceApiPolicyResource.ResourceType, out string serviceWorkspaceApiPolicyWorkspaceApiPolicyApiVersion); + _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient = new WorkspaceApiPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiPolicyWorkspaceApiPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceApiResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates policy configuration for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_ListByApi + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ServiceWorkspaceApiPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics, Pipeline, "ServiceWorkspaceApiPolicyCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_ListByApi + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return PageableHelpers.CreatePageable(FirstPageRequest, null, e => new ServiceWorkspaceApiPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics, Pipeline, "ServiceWorkspaceApiPolicyCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> ExistsAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Exists(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiPolicyResource.cs new file mode 100644 index 000000000000..722a5b0fbf27 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiPolicyResource.cs @@ -0,0 +1,364 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceApiPolicy along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceApiPolicyResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceApiPolicy method. + /// + public partial class ServiceWorkspaceApiPolicyResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, PolicyName policyId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics; + private readonly WorkspaceApiPolicyRestOperations _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient; + private readonly PolicyContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiPolicyResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceApiPolicyResource(ArmClient client, PolicyContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceApiPolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceApiPolicyWorkspaceApiPolicyApiVersion); + _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient = new WorkspaceApiPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiPolicyWorkspaceApiPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/apis/policies"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PolicyContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the Api. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the Api. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the API policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the API policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiPolicyWorkspaceApiPolicyClientDiagnostics.CreateScope("ServiceWorkspaceApiPolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiPolicyWorkspaceApiPolicyRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiReleaseCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiReleaseCollection.cs new file mode 100644 index 000000000000..421d55d34d22 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiReleaseCollection.cs @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceApiReleases method from an instance of . + /// + public partial class ServiceWorkspaceApiReleaseCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics; + private readonly WorkspaceApiReleaseRestOperations _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiReleaseCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceApiReleaseCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceApiReleaseResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceApiReleaseResource.ResourceType, out string serviceWorkspaceApiReleaseWorkspaceApiReleaseApiVersion); + _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient = new WorkspaceApiReleaseRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiReleaseWorkspaceApiReleaseApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceApiResource.ResourceType), nameof(id)); + } + + /// + /// Creates a new Release for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string releaseId, ApiReleaseData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, releaseId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiReleaseResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new Release for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string releaseId, ApiReleaseData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, releaseId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiReleaseResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the details of an API release. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Get + /// + /// + /// + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, releaseId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiReleaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the details of an API release. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Get + /// + /// + /// + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, releaseId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiReleaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// 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. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases + /// + /// + /// Operation Id + /// WorkspaceApiRelease_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiReleaseResource(Client, ApiReleaseData.DeserializeApiReleaseData(e)), _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics, Pipeline, "ServiceWorkspaceApiReleaseCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// 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. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases + /// + /// + /// Operation Id + /// WorkspaceApiRelease_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| notes | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiReleaseResource(Client, ApiReleaseData.DeserializeApiReleaseData(e)), _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics, Pipeline, "ServiceWorkspaceApiReleaseCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Get + /// + /// + /// + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Get + /// + /// + /// + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string releaseId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(releaseId, nameof(releaseId)); + + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, releaseId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiReleaseResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiReleaseResource.cs new file mode 100644 index 000000000000..464730977e91 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiReleaseResource.cs @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceApiRelease along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceApiReleaseResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceApiRelease method. + /// + public partial class ServiceWorkspaceApiReleaseResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string releaseId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics; + private readonly WorkspaceApiReleaseRestOperations _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient; + private readonly ApiReleaseData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiReleaseResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceApiReleaseResource(ArmClient client, ApiReleaseData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceApiReleaseResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceApiReleaseWorkspaceApiReleaseApiVersion); + _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient = new WorkspaceApiReleaseRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiReleaseWorkspaceApiReleaseApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/apis/releases"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiReleaseData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Returns the details of an API release. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiReleaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the details of an API release. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiReleaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified release in the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified release in the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the release of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Update + /// + /// + /// + /// 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. + /// API Release Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, ApiReleaseData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceWorkspaceApiReleaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the release of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Update + /// + /// + /// + /// 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. + /// API Release Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, ApiReleaseData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken); + return Response.FromValue(new ServiceWorkspaceApiReleaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the etag of an API release. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the etag of an API release. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiReleaseWorkspaceApiReleaseClientDiagnostics.CreateScope("ServiceWorkspaceApiReleaseResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiReleaseWorkspaceApiReleaseRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiResource.cs new file mode 100644 index 000000000000..0cb6c242da50 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiResource.cs @@ -0,0 +1,620 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceApi along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceApiResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceApi method. + /// + public partial class ServiceWorkspaceApiResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceApiWorkspaceApiClientDiagnostics; + private readonly WorkspaceApiRestOperations _serviceWorkspaceApiWorkspaceApiRestClient; + private readonly ClientDiagnostics _workspaceApiRevisionClientDiagnostics; + private readonly WorkspaceApiRevisionRestOperations _workspaceApiRevisionRestClient; + private readonly ApiData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceApiResource(ArmClient client, ApiData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceApiResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiWorkspaceApiClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceApiWorkspaceApiApiVersion); + _serviceWorkspaceApiWorkspaceApiRestClient = new WorkspaceApiRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiWorkspaceApiApiVersion); + _workspaceApiRevisionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _workspaceApiRevisionRestClient = new WorkspaceApiRevisionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/apis"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of ServiceWorkspaceApiReleaseResources in the ServiceWorkspaceApi. + /// An object representing collection of ServiceWorkspaceApiReleaseResources and their operations over a ServiceWorkspaceApiReleaseResource. + public virtual ServiceWorkspaceApiReleaseCollection GetServiceWorkspaceApiReleases() + { + return GetCachedClient(Client => new ServiceWorkspaceApiReleaseCollection(Client, Id)); + } + + /// + /// Returns the details of an API release. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Get + /// + /// + /// + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceApiReleaseAsync(string releaseId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceApiReleases().GetAsync(releaseId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns the details of an API release. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/releases/{releaseId} + /// + /// + /// Operation Id + /// WorkspaceApiRelease_Get + /// + /// + /// + /// Release identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceApiRelease(string releaseId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceApiReleases().Get(releaseId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceApiOperationResources in the ServiceWorkspaceApi. + /// An object representing collection of ServiceWorkspaceApiOperationResources and their operations over a ServiceWorkspaceApiOperationResource. + public virtual ServiceWorkspaceApiOperationCollection GetServiceWorkspaceApiOperations() + { + return GetCachedClient(Client => new ServiceWorkspaceApiOperationCollection(Client, Id)); + } + + /// + /// Gets the details of the API Operation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Get + /// + /// + /// + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceApiOperationAsync(string operationId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceApiOperations().GetAsync(operationId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the API Operation specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/operations/{operationId} + /// + /// + /// Operation Id + /// WorkspaceApiOperation_Get + /// + /// + /// + /// Operation identifier within an API. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceApiOperation(string operationId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceApiOperations().Get(operationId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceApiPolicyResources in the ServiceWorkspaceApi. + /// An object representing collection of ServiceWorkspaceApiPolicyResources and their operations over a ServiceWorkspaceApiPolicyResource. + public virtual ServiceWorkspaceApiPolicyCollection GetServiceWorkspaceApiPolicies() + { + return GetCachedClient(Client => new ServiceWorkspaceApiPolicyCollection(Client, Id)); + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceApiPolicyAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceApiPolicies().GetAsync(policyId, format, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceApiPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceApiPolicy(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceApiPolicies().Get(policyId, format, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceApiSchemaResources in the ServiceWorkspaceApi. + /// An object representing collection of ServiceWorkspaceApiSchemaResources and their operations over a ServiceWorkspaceApiSchemaResource. + public virtual ServiceWorkspaceApiSchemaCollection GetServiceWorkspaceApiSchemas() + { + return GetCachedClient(Client => new ServiceWorkspaceApiSchemaCollection(Client, Id)); + } + + /// + /// Get the schema configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceApiSchemaAsync(string schemaId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceApiSchemas().GetAsync(schemaId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the schema configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceApiSchema(string schemaId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceApiSchemas().Get(schemaId, cancellationToken); + } + + /// + /// Gets the details of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiWorkspaceApiRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiWorkspaceApiRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// Delete all revisions of the Api. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, bool? deleteRevisions = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiWorkspaceApiRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, deleteRevisions, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// Delete all revisions of the Api. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, bool? deleteRevisions = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiWorkspaceApiRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, deleteRevisions, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the specified API of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Update + /// + /// + /// + /// 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. + /// API Update Contract parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, ApiUpdateContract apiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apiUpdateContract, nameof(apiUpdateContract)); + + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiWorkspaceApiRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, apiUpdateContract, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceWorkspaceApiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the specified API of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Update + /// + /// + /// + /// 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. + /// API Update Contract parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, ApiUpdateContract apiUpdateContract, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apiUpdateContract, nameof(apiUpdateContract)); + + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiWorkspaceApiRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, apiUpdateContract, cancellationToken); + return Response.FromValue(new ServiceWorkspaceApiResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all revisions of an API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/revisions + /// + /// + /// Operation Id + /// WorkspaceApiRevision_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkspaceApiRevisionsByServiceAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceApiRevisionRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workspaceApiRevisionRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApiRevisionContract.DeserializeApiRevisionContract, _workspaceApiRevisionClientDiagnostics, Pipeline, "ServiceWorkspaceApiResource.GetWorkspaceApiRevisionsByService", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all revisions of an API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/revisions + /// + /// + /// Operation Id + /// WorkspaceApiRevision_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiRevision | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkspaceApiRevisionsByService(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceApiRevisionRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workspaceApiRevisionRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApiRevisionContract.DeserializeApiRevisionContract, _workspaceApiRevisionClientDiagnostics, Pipeline, "ServiceWorkspaceApiResource.GetWorkspaceApiRevisionsByService", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the entity state (Etag) version of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiWorkspaceApiRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiWorkspaceApiClientDiagnostics.CreateScope("ServiceWorkspaceApiResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiWorkspaceApiRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiSchemaCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiSchemaCollection.cs new file mode 100644 index 000000000000..d57efb0e6042 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiSchemaCollection.cs @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceApiSchemas method from an instance of . + /// + public partial class ServiceWorkspaceApiSchemaCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics; + private readonly WorkspaceApiSchemaRestOperations _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiSchemaCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceApiSchemaCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceApiSchemaResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceApiSchemaResource.ResourceType, out string serviceWorkspaceApiSchemaWorkspaceApiSchemaApiVersion); + _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient = new WorkspaceApiSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiSchemaWorkspaceApiSchemaApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceApiResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceApiResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates schema configuration for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The schema contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string schemaId, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, schemaId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceApiSchemaOperationSource(Client), _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics, Pipeline, _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates schema configuration for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The schema contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string schemaId, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, schemaId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceApiSchemaOperationSource(Client), _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics, Pipeline, _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the schema configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, schemaId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the schema configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, schemaId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the schema configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas + /// + /// + /// Operation Id + /// WorkspaceApiSchema_ListByApi + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiSchemaResource(Client, ApiSchemaData.DeserializeApiSchemaData(e)), _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics, Pipeline, "ServiceWorkspaceApiSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Get the schema configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas + /// + /// + /// Operation Id + /// WorkspaceApiSchema_ListByApi + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateListByApiNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiSchemaResource(Client, ApiSchemaData.DeserializeApiSchemaData(e)), _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics, Pipeline, "ServiceWorkspaceApiSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiSchemaResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiSchemaResource.cs new file mode 100644 index 000000000000..baa3eff0185a --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiSchemaResource.cs @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceApiSchema along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceApiSchemaResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceApiSchema method. + /// + public partial class ServiceWorkspaceApiSchemaResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string apiId, string schemaId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics; + private readonly WorkspaceApiSchemaRestOperations _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient; + private readonly ApiSchemaData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiSchemaResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceApiSchemaResource(ArmClient client, ApiSchemaData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceApiSchemaResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceApiSchemaWorkspaceApiSchemaApiVersion); + _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient = new WorkspaceApiSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiSchemaWorkspaceApiSchemaApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/apis/schemas"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiSchemaData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get the schema configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the schema configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the schema configuration at the Api. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// If true removes all references to the schema before deleting it. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, bool? force = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, force, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the schema configuration at the Api. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// If true removes all references to the schema before deleting it. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, bool? force = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, force, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates schema configuration for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The schema contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceApiSchemaOperationSource(Client), _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics, Pipeline, _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates schema configuration for the API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The schema contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ApiSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceApiSchemaOperationSource(Client), _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics, Pipeline, _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceApiSchema_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiSchemaWorkspaceApiSchemaClientDiagnostics.CreateScope("ServiceWorkspaceApiSchemaResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiSchemaWorkspaceApiSchemaRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiVersionSetCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiVersionSetCollection.cs new file mode 100644 index 000000000000..36e6581dc781 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiVersionSetCollection.cs @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceApiVersionSets method from an instance of . + /// + public partial class ServiceWorkspaceApiVersionSetCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics; + private readonly WorkspaceApiVersionSetRestOperations _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiVersionSetCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceApiVersionSetCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceApiVersionSetResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceApiVersionSetResource.ResourceType, out string serviceWorkspaceApiVersionSetWorkspaceApiVersionSetApiVersion); + _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient = new WorkspaceApiVersionSetRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiVersionSetWorkspaceApiVersionSetApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or Updates a Api Version Set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string versionSetId, ApiVersionSetData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, versionSetId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiVersionSetResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or Updates a Api Version Set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string versionSetId, ApiVersionSetData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, versionSetId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceApiVersionSetResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Api Version Set specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Get + /// + /// + /// + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, versionSetId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Api Version Set specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Get + /// + /// + /// + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, versionSetId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of API Version Sets in the specified workspace with a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiVersionSetResource(Client, ApiVersionSetData.DeserializeApiVersionSetData(e)), _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics, Pipeline, "ServiceWorkspaceApiVersionSetCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of API Version Sets in the specified workspace with a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceApiVersionSetResource(Client, ApiVersionSetData.DeserializeApiVersionSetData(e)), _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics, Pipeline, "ServiceWorkspaceApiVersionSetCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Get + /// + /// + /// + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, versionSetId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Get + /// + /// + /// + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string versionSetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(versionSetId, nameof(versionSetId)); + + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, versionSetId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiVersionSetResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiVersionSetResource.cs new file mode 100644 index 000000000000..315006ac5024 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceApiVersionSetResource.cs @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceApiVersionSet along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceApiVersionSetResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceApiVersionSet method. + /// + public partial class ServiceWorkspaceApiVersionSetResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string versionSetId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics; + private readonly WorkspaceApiVersionSetRestOperations _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient; + private readonly ApiVersionSetData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceApiVersionSetResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceApiVersionSetResource(ArmClient client, ApiVersionSetData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceApiVersionSetResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceApiVersionSetWorkspaceApiVersionSetApiVersion); + _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient = new WorkspaceApiVersionSetRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceApiVersionSetWorkspaceApiVersionSetApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/apiVersionSets"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiVersionSetData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the Api Version Set specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Api Version Set specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific Api Version Set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific Api Version Set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the Api VersionSet specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Update + /// + /// + /// + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apiVersionSetUpdateParameters, nameof(apiVersionSetUpdateParameters)); + + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, apiVersionSetUpdateParameters, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceWorkspaceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the Api VersionSet specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Update + /// + /// + /// + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, ApiVersionSetUpdateParameters apiVersionSetUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(apiVersionSetUpdateParameters, nameof(apiVersionSetUpdateParameters)); + + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, apiVersionSetUpdateParameters, cancellationToken); + return Response.FromValue(new ServiceWorkspaceApiVersionSetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Api Version Set specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Api Version Set specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetClientDiagnostics.CreateScope("ServiceWorkspaceApiVersionSetResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceApiVersionSetWorkspaceApiVersionSetRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceGroupCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceGroupCollection.cs new file mode 100644 index 000000000000..88139cbd5aaf --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceGroupCollection.cs @@ -0,0 +1,349 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceGroups method from an instance of . + /// + public partial class ServiceWorkspaceGroupCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics; + private readonly WorkspaceGroupRestOperations _serviceWorkspaceGroupWorkspaceGroupRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceGroupCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceGroupCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceGroupResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceGroupResource.ResourceType, out string serviceWorkspaceGroupWorkspaceGroupApiVersion); + _serviceWorkspaceGroupWorkspaceGroupRestClient = new WorkspaceGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceGroupWorkspaceGroupApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or Updates a group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Group identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNull(groupCreateParameters, nameof(groupCreateParameters)); + + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceGroupWorkspaceGroupRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupId, groupCreateParameters, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceGroupResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or Updates a group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Group identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string groupId, GroupCreateParameters groupCreateParameters, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNull(groupCreateParameters, nameof(groupCreateParameters)); + + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceGroupWorkspaceGroupRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupId, groupCreateParameters, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceGroupResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Get + /// + /// + /// + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceGroupWorkspaceGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Get + /// + /// + /// + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceGroupWorkspaceGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of groups defined within a workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups + /// + /// + /// Operation Id + /// WorkspaceGroup_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceGroupWorkspaceGroupRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceGroupWorkspaceGroupRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics, Pipeline, "ServiceWorkspaceGroupCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of groups defined within a workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups + /// + /// + /// Operation Id + /// WorkspaceGroup_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceGroupWorkspaceGroupRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceGroupWorkspaceGroupRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceGroupResource(Client, ApiManagementGroupData.DeserializeApiManagementGroupData(e)), _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics, Pipeline, "ServiceWorkspaceGroupCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Get + /// + /// + /// + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceGroupWorkspaceGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Get + /// + /// + /// + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string groupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceGroupWorkspaceGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, groupId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceGroupResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceGroupResource.cs new file mode 100644 index 000000000000..6a22588fd4b1 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceGroupResource.cs @@ -0,0 +1,618 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceGroup along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceGroupResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceGroup method. + /// + public partial class ServiceWorkspaceGroupResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string groupId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics; + private readonly WorkspaceGroupRestOperations _serviceWorkspaceGroupWorkspaceGroupRestClient; + private readonly ClientDiagnostics _workspaceGroupUserClientDiagnostics; + private readonly WorkspaceGroupUserRestOperations _workspaceGroupUserRestClient; + private readonly ApiManagementGroupData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceGroupResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceGroupResource(ArmClient client, ApiManagementGroupData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceGroupWorkspaceGroupApiVersion); + _serviceWorkspaceGroupWorkspaceGroupRestClient = new WorkspaceGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceGroupWorkspaceGroupApiVersion); + _workspaceGroupUserClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _workspaceGroupUserRestClient = new WorkspaceGroupUserRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/groups"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiManagementGroupData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceGroupWorkspaceGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceGroupWorkspaceGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific group of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceGroupWorkspaceGroupRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific group of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceGroupWorkspaceGroupRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Update + /// + /// + /// + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, GroupUpdateParameters groupUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(groupUpdateParameters, nameof(groupUpdateParameters)); + + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceGroupWorkspaceGroupRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, groupUpdateParameters, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceWorkspaceGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Update + /// + /// + /// + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, GroupUpdateParameters groupUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(groupUpdateParameters, nameof(groupUpdateParameters)); + + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceGroupWorkspaceGroupRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, groupUpdateParameters, cancellationToken); + return Response.FromValue(new ServiceWorkspaceGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of user entities associated with the group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users + /// + /// + /// Operation Id + /// WorkspaceGroupUser_List + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkspaceGroupUsersAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceGroupUserRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workspaceGroupUserRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementUserResource(Client, UserContractData.DeserializeUserContractData(e)), _workspaceGroupUserClientDiagnostics, Pipeline, "ServiceWorkspaceGroupResource.GetWorkspaceGroupUsers", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of user entities associated with the group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users + /// + /// + /// Operation Id + /// WorkspaceGroupUser_List + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| firstName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| lastName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| email | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| registrationDate | filter | ge, le, eq, ne, gt, lt | |</br>| note | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkspaceGroupUsers(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceGroupUserRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workspaceGroupUserRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementUserResource(Client, UserContractData.DeserializeUserContractData(e)), _workspaceGroupUserClientDiagnostics, Pipeline, "ServiceWorkspaceGroupResource.GetWorkspaceGroupUsers", "value", "nextLink", cancellationToken); + } + + /// + /// Checks that user entity specified by identifier is associated with the group entity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId} + /// + /// + /// Operation Id + /// WorkspaceGroupUser_CheckEntityExists + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> CheckEntityExistsWorkspaceGroupUserAsync(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceGroupUserClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.CheckEntityExistsWorkspaceGroupUser"); + scope.Start(); + try + { + var response = await _workspaceGroupUserRestClient.CheckEntityExistsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks that user entity specified by identifier is associated with the group entity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId} + /// + /// + /// Operation Id + /// WorkspaceGroupUser_CheckEntityExists + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response CheckEntityExistsWorkspaceGroupUser(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceGroupUserClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.CheckEntityExistsWorkspaceGroupUser"); + scope.Start(); + try + { + var response = _workspaceGroupUserRestClient.CheckEntityExists(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add existing user to existing group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId} + /// + /// + /// Operation Id + /// WorkspaceGroupUser_Create + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> CreateWorkspaceGroupUserAsync(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceGroupUserClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.CreateWorkspaceGroupUser"); + scope.Start(); + try + { + var response = await _workspaceGroupUserRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ApiManagementUserResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add existing user to existing group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId} + /// + /// + /// Operation Id + /// WorkspaceGroupUser_Create + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response CreateWorkspaceGroupUser(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceGroupUserClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.CreateWorkspaceGroupUser"); + scope.Start(); + try + { + var response = _workspaceGroupUserRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken); + return Response.FromValue(new ApiManagementUserResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Remove existing user from existing group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId} + /// + /// + /// Operation Id + /// WorkspaceGroupUser_Delete + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task DeleteWorkspaceGroupUserAsync(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceGroupUserClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.DeleteWorkspaceGroupUser"); + scope.Start(); + try + { + var response = await _workspaceGroupUserRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Remove existing user from existing group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId}/users/{userId} + /// + /// + /// Operation Id + /// WorkspaceGroupUser_Delete + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response DeleteWorkspaceGroupUser(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceGroupUserClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.DeleteWorkspaceGroupUser"); + scope.Start(); + try + { + var response = _workspaceGroupUserRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceGroupWorkspaceGroupRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceGroupWorkspaceGroupClientDiagnostics.CreateScope("ServiceWorkspaceGroupResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceGroupWorkspaceGroupRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNamedValueCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNamedValueCollection.cs new file mode 100644 index 000000000000..ca436bfd13f4 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNamedValueCollection.cs @@ -0,0 +1,351 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceNamedValues method from an instance of . + /// + public partial class ServiceWorkspaceNamedValueCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics; + private readonly WorkspaceNamedValueRestOperations _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceNamedValueCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceNamedValueCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceNamedValueResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceNamedValueResource.ResourceType, out string serviceWorkspaceNamedValueWorkspaceNamedValueApiVersion); + _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient = new WorkspaceNamedValueRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceNamedValueWorkspaceNamedValueApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates named value. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Identifier of the NamedValue. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + Argument.AssertNotNull(namedValueCreateContract, nameof(namedValueCreateContract)); + + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namedValueId, namedValueCreateContract, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceNamedValueOperationSource(Client), _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics, Pipeline, _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namedValueId, namedValueCreateContract, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates named value. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Identifier of the NamedValue. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string namedValueId, NamedValueCreateContract namedValueCreateContract, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + Argument.AssertNotNull(namedValueCreateContract, nameof(namedValueCreateContract)); + + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namedValueId, namedValueCreateContract, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceNamedValueOperationSource(Client), _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics, Pipeline, _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namedValueId, namedValueCreateContract, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Get + /// + /// + /// + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namedValueId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNamedValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Get + /// + /// + /// + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namedValueId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNamedValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of named values defined within a workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues + /// + /// + /// Operation Id + /// WorkspaceNamedValue_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// When set to true, the response contains only named value entities which failed refresh. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, bool? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceNamedValueResource(Client, ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(e)), _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics, Pipeline, "ServiceWorkspaceNamedValueCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of named values defined within a workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues + /// + /// + /// Operation Id + /// WorkspaceNamedValue_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| tags | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith, any, all |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// When set to true, the response contains only named value entities which failed refresh. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, bool? isKeyVaultRefreshFailed = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, isKeyVaultRefreshFailed); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceNamedValueResource(Client, ApiManagementNamedValueData.DeserializeApiManagementNamedValueData(e)), _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics, Pipeline, "ServiceWorkspaceNamedValueCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Get + /// + /// + /// + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namedValueId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Get + /// + /// + /// + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string namedValueId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(namedValueId, nameof(namedValueId)); + + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, namedValueId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNamedValueResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNamedValueResource.cs new file mode 100644 index 000000000000..0b542a513d22 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNamedValueResource.cs @@ -0,0 +1,490 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceNamedValue along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceNamedValueResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceNamedValue method. + /// + public partial class ServiceWorkspaceNamedValueResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string namedValueId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics; + private readonly WorkspaceNamedValueRestOperations _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient; + private readonly ApiManagementNamedValueData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceNamedValueResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceNamedValueResource(ArmClient client, ApiManagementNamedValueData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceNamedValueResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceNamedValueWorkspaceNamedValueApiVersion); + _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient = new WorkspaceNamedValueRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceNamedValueWorkspaceNamedValueApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/namedValues"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiManagementNamedValueData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNamedValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNamedValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific named value from the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific named value from the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the specific named value. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Update + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(namedValueUpdateParameters, nameof(namedValueUpdateParameters)); + + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, namedValueUpdateParameters, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceNamedValueOperationSource(Client), _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics, Pipeline, _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, namedValueUpdateParameters).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the specific named value. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Update + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ETag ifMatch, NamedValueUpdateParameters namedValueUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(namedValueUpdateParameters, nameof(namedValueUpdateParameters)); + + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, namedValueUpdateParameters, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceNamedValueOperationSource(Client), _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics, Pipeline, _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, namedValueUpdateParameters).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the secret of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}/listValue + /// + /// + /// Operation Id + /// WorkspaceNamedValue_ListValue + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetValueAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.GetValue"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.ListValueAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the secret of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}/listValue + /// + /// + /// Operation Id + /// WorkspaceNamedValue_ListValue + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetValue(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.GetValue"); + scope.Start(); + try + { + var response = _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.ListValue(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Refresh the secret of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}/refreshSecret + /// + /// + /// Operation Id + /// WorkspaceNamedValue_RefreshSecret + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task> RefreshSecretAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.RefreshSecret"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.RefreshSecretAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceNamedValueOperationSource(Client), _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics, Pipeline, _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateRefreshSecretRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Refresh the secret of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId}/refreshSecret + /// + /// + /// Operation Id + /// WorkspaceNamedValue_RefreshSecret + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation RefreshSecret(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.RefreshSecret"); + scope.Start(); + try + { + var response = _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.RefreshSecret(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceNamedValueOperationSource(Client), _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics, Pipeline, _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.CreateRefreshSecretRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNamedValueWorkspaceNamedValueClientDiagnostics.CreateScope("ServiceWorkspaceNamedValueResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceNamedValueWorkspaceNamedValueRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNotificationCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNotificationCollection.cs new file mode 100644 index 000000000000..ea5a1f02f418 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNotificationCollection.cs @@ -0,0 +1,319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceNotifications method from an instance of . + /// + public partial class ServiceWorkspaceNotificationCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics; + private readonly WorkspaceNotificationRestOperations _serviceWorkspaceNotificationWorkspaceNotificationRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceNotificationCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceNotificationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceNotificationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceNotificationResource.ResourceType, out string serviceWorkspaceNotificationWorkspaceNotificationApiVersion); + _serviceWorkspaceNotificationWorkspaceNotificationRestClient = new WorkspaceNotificationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceNotificationWorkspaceNotificationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Create or Update API Management publisher notification for the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Notification Name Identifier. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, NotificationName notificationName, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNotificationWorkspaceNotificationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, notificationName, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceNotificationResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or Update API Management publisher notification for the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Notification Name Identifier. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, NotificationName notificationName, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceNotificationWorkspaceNotificationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, notificationName, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceNotificationResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Notification specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_Get + /// + /// + /// + /// Notification Name Identifier. + /// The cancellation token to use. + public virtual async Task> GetAsync(NotificationName notificationName, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNotificationWorkspaceNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, notificationName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNotificationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Notification specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_Get + /// + /// + /// + /// Notification Name Identifier. + /// The cancellation token to use. + public virtual Response Get(NotificationName notificationName, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceNotificationWorkspaceNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, notificationName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNotificationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of properties defined within a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications + /// + /// + /// Operation Id + /// WorkspaceNotification_ListByService + /// + /// + /// + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceNotificationWorkspaceNotificationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceNotificationWorkspaceNotificationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceNotificationResource(Client, ApiManagementNotificationData.DeserializeApiManagementNotificationData(e)), _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics, Pipeline, "ServiceWorkspaceNotificationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of properties defined within a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications + /// + /// + /// Operation Id + /// WorkspaceNotification_ListByService + /// + /// + /// + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceNotificationWorkspaceNotificationRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceNotificationWorkspaceNotificationRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceNotificationResource(Client, ApiManagementNotificationData.DeserializeApiManagementNotificationData(e)), _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics, Pipeline, "ServiceWorkspaceNotificationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_Get + /// + /// + /// + /// Notification Name Identifier. + /// The cancellation token to use. + public virtual async Task> ExistsAsync(NotificationName notificationName, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNotificationWorkspaceNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, notificationName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_Get + /// + /// + /// + /// Notification Name Identifier. + /// The cancellation token to use. + public virtual Response Exists(NotificationName notificationName, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceNotificationWorkspaceNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, notificationName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNotificationResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNotificationResource.cs new file mode 100644 index 000000000000..6d60262f8b98 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceNotificationResource.cs @@ -0,0 +1,736 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceNotification along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceNotificationResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceNotification method. + /// + public partial class ServiceWorkspaceNotificationResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, NotificationName notificationName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics; + private readonly WorkspaceNotificationRestOperations _serviceWorkspaceNotificationWorkspaceNotificationRestClient; + private readonly ClientDiagnostics _workspaceNotificationRecipientUserClientDiagnostics; + private readonly WorkspaceNotificationRecipientUserRestOperations _workspaceNotificationRecipientUserRestClient; + private readonly ClientDiagnostics _workspaceNotificationRecipientEmailClientDiagnostics; + private readonly WorkspaceNotificationRecipientEmailRestOperations _workspaceNotificationRecipientEmailRestClient; + private readonly ApiManagementNotificationData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceNotificationResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceNotificationResource(ArmClient client, ApiManagementNotificationData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceNotificationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceNotificationWorkspaceNotificationApiVersion); + _serviceWorkspaceNotificationWorkspaceNotificationRestClient = new WorkspaceNotificationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceNotificationWorkspaceNotificationApiVersion); + _workspaceNotificationRecipientUserClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _workspaceNotificationRecipientUserRestClient = new WorkspaceNotificationRecipientUserRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _workspaceNotificationRecipientEmailClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _workspaceNotificationRecipientEmailRestClient = new WorkspaceNotificationRecipientEmailRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/notifications"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiManagementNotificationData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the Notification specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNotificationWorkspaceNotificationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNotificationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Notification specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceNotificationWorkspaceNotificationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceNotificationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or Update API Management publisher notification for the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceNotificationWorkspaceNotificationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceNotificationResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or Update API Management publisher notification for the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + public virtual ArmOperation Update(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceNotificationWorkspaceNotificationClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceNotificationWorkspaceNotificationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceNotificationResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of the Notification Recipient User subscribed to the notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientUser_ListByNotification + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkspaceNotificationRecipientUsersByNotificationAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceNotificationRecipientUserRestClient.CreateListByNotificationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, RecipientUserContract.DeserializeRecipientUserContract, _workspaceNotificationRecipientUserClientDiagnostics, Pipeline, "ServiceWorkspaceNotificationResource.GetWorkspaceNotificationRecipientUsersByNotification", "value", null, cancellationToken); + } + + /// + /// Gets the list of the Notification Recipient User subscribed to the notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientUser_ListByNotification + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkspaceNotificationRecipientUsersByNotification(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceNotificationRecipientUserRestClient.CreateListByNotificationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return PageableHelpers.CreatePageable(FirstPageRequest, null, RecipientUserContract.DeserializeRecipientUserContract, _workspaceNotificationRecipientUserClientDiagnostics, Pipeline, "ServiceWorkspaceNotificationResource.GetWorkspaceNotificationRecipientUsersByNotification", "value", null, cancellationToken); + } + + /// + /// Determine if the Notification Recipient User is subscribed to the notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientUser_CheckEntityExists + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> CheckEntityExistsWorkspaceNotificationRecipientUserAsync(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceNotificationRecipientUserClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.CheckEntityExistsWorkspaceNotificationRecipientUser"); + scope.Start(); + try + { + var response = await _workspaceNotificationRecipientUserRestClient.CheckEntityExistsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Determine if the Notification Recipient User is subscribed to the notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientUser_CheckEntityExists + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response CheckEntityExistsWorkspaceNotificationRecipientUser(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceNotificationRecipientUserClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.CheckEntityExistsWorkspaceNotificationRecipientUser"); + scope.Start(); + try + { + var response = _workspaceNotificationRecipientUserRestClient.CheckEntityExists(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds the API Management User to the list of Recipients for the Notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientUser_CreateOrUpdate + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> CreateOrUpdateWorkspaceNotificationRecipientUserAsync(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceNotificationRecipientUserClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.CreateOrUpdateWorkspaceNotificationRecipientUser"); + scope.Start(); + try + { + var response = await _workspaceNotificationRecipientUserRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds the API Management User to the list of Recipients for the Notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientUser_CreateOrUpdate + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response CreateOrUpdateWorkspaceNotificationRecipientUser(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceNotificationRecipientUserClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.CreateOrUpdateWorkspaceNotificationRecipientUser"); + scope.Start(); + try + { + var response = _workspaceNotificationRecipientUserRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes the API Management user from the list of Notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientUser_Delete + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task DeleteWorkspaceNotificationRecipientUserAsync(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceNotificationRecipientUserClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.DeleteWorkspaceNotificationRecipientUser"); + scope.Start(); + try + { + var response = await _workspaceNotificationRecipientUserRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes the API Management user from the list of Notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientUsers/{userId} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientUser_Delete + /// + /// + /// + /// User identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response DeleteWorkspaceNotificationRecipientUser(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + using var scope = _workspaceNotificationRecipientUserClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.DeleteWorkspaceNotificationRecipientUser"); + scope.Start(); + try + { + var response = _workspaceNotificationRecipientUserRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, userId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of the Notification Recipient Emails subscribed to a notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientEmail_ListByNotification + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkspaceNotificationRecipientEmailsByNotificationAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceNotificationRecipientEmailRestClient.CreateListByNotificationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, RecipientEmailContract.DeserializeRecipientEmailContract, _workspaceNotificationRecipientEmailClientDiagnostics, Pipeline, "ServiceWorkspaceNotificationResource.GetWorkspaceNotificationRecipientEmailsByNotification", "value", null, cancellationToken); + } + + /// + /// Gets the list of the Notification Recipient Emails subscribed to a notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientEmail_ListByNotification + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkspaceNotificationRecipientEmailsByNotification(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceNotificationRecipientEmailRestClient.CreateListByNotificationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return PageableHelpers.CreatePageable(FirstPageRequest, null, RecipientEmailContract.DeserializeRecipientEmailContract, _workspaceNotificationRecipientEmailClientDiagnostics, Pipeline, "ServiceWorkspaceNotificationResource.GetWorkspaceNotificationRecipientEmailsByNotification", "value", null, cancellationToken); + } + + /// + /// Determine if Notification Recipient Email subscribed to the notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientEmail_CheckEntityExists + /// + /// + /// + /// Email identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> CheckEntityExistsWorkspaceNotificationRecipientEmailAsync(string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var scope = _workspaceNotificationRecipientEmailClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.CheckEntityExistsWorkspaceNotificationRecipientEmail"); + scope.Start(); + try + { + var response = await _workspaceNotificationRecipientEmailRestClient.CheckEntityExistsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, email, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Determine if Notification Recipient Email subscribed to the notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientEmail_CheckEntityExists + /// + /// + /// + /// Email identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response CheckEntityExistsWorkspaceNotificationRecipientEmail(string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var scope = _workspaceNotificationRecipientEmailClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.CheckEntityExistsWorkspaceNotificationRecipientEmail"); + scope.Start(); + try + { + var response = _workspaceNotificationRecipientEmailRestClient.CheckEntityExists(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, email, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds the Email address to the list of Recipients for the Notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientEmail_CreateOrUpdate + /// + /// + /// + /// Email identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> CreateOrUpdateWorkspaceNotificationRecipientEmailAsync(string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var scope = _workspaceNotificationRecipientEmailClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.CreateOrUpdateWorkspaceNotificationRecipientEmail"); + scope.Start(); + try + { + var response = await _workspaceNotificationRecipientEmailRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, email, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds the Email address to the list of Recipients for the Notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientEmail_CreateOrUpdate + /// + /// + /// + /// Email identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response CreateOrUpdateWorkspaceNotificationRecipientEmail(string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var scope = _workspaceNotificationRecipientEmailClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.CreateOrUpdateWorkspaceNotificationRecipientEmail"); + scope.Start(); + try + { + var response = _workspaceNotificationRecipientEmailRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, email, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes the email from the list of Notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientEmail_Delete + /// + /// + /// + /// Email identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task DeleteWorkspaceNotificationRecipientEmailAsync(string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var scope = _workspaceNotificationRecipientEmailClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.DeleteWorkspaceNotificationRecipientEmail"); + scope.Start(); + try + { + var response = await _workspaceNotificationRecipientEmailRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, email, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes the email from the list of Notification. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName}/recipientEmails/{email} + /// + /// + /// Operation Id + /// WorkspaceNotificationRecipientEmail_Delete + /// + /// + /// + /// Email identifier. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response DeleteWorkspaceNotificationRecipientEmail(string email, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(email, nameof(email)); + + using var scope = _workspaceNotificationRecipientEmailClientDiagnostics.CreateScope("ServiceWorkspaceNotificationResource.DeleteWorkspaceNotificationRecipientEmail"); + scope.Start(); + try + { + var response = _workspaceNotificationRecipientEmailRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, email, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyCollection.cs new file mode 100644 index 000000000000..c763ac5304af --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyCollection.cs @@ -0,0 +1,325 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspacePolicies method from an instance of . + /// + public partial class ServiceWorkspacePolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics; + private readonly WorkspacePolicyRestOperations _serviceWorkspacePolicyWorkspacePolicyRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspacePolicyCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspacePolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspacePolicyResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspacePolicyResource.ResourceType, out string serviceWorkspacePolicyWorkspacePolicyApiVersion); + _serviceWorkspacePolicyWorkspacePolicyRestClient = new WorkspacePolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspacePolicyWorkspacePolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates policy configuration for the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyWorkspacePolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspacePolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyWorkspacePolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspacePolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyWorkspacePolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyId, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyWorkspacePolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyId, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the workspace level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies + /// + /// + /// Operation Id + /// WorkspacePolicy_ListByApi + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspacePolicyWorkspacePolicyRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ServiceWorkspacePolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics, Pipeline, "ServiceWorkspacePolicyCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Get the policy configuration at the workspace level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies + /// + /// + /// Operation Id + /// WorkspacePolicy_ListByApi + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspacePolicyWorkspacePolicyRestClient.CreateListByApiRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return PageableHelpers.CreatePageable(FirstPageRequest, null, e => new ServiceWorkspacePolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics, Pipeline, "ServiceWorkspacePolicyCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> ExistsAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyWorkspacePolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Exists(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyWorkspacePolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyFragmentCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyFragmentCollection.cs new file mode 100644 index 000000000000..f4725e32eccc --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyFragmentCollection.cs @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspacePolicyFragments method from an instance of . + /// + public partial class ServiceWorkspacePolicyFragmentCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics; + private readonly WorkspacePolicyFragmentRestOperations _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspacePolicyFragmentCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspacePolicyFragmentCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspacePolicyFragmentResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspacePolicyFragmentResource.ResourceType, out string serviceWorkspacePolicyFragmentWorkspacePolicyFragmentApiVersion); + _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient = new WorkspacePolicyFragmentRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspacePolicyFragmentWorkspacePolicyFragmentApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A resource identifier. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string id, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspacePolicyFragmentOperationSource(Client), _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics, Pipeline, _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A resource identifier. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string id, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspacePolicyFragmentOperationSource(Client), _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics, Pipeline, _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets all policy fragments defined within a workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, orderBy, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ServiceWorkspacePolicyFragmentResource(Client, PolicyFragmentContractData.DeserializePolicyFragmentContractData(e)), _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics, Pipeline, "ServiceWorkspacePolicyFragmentCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Gets all policy fragments defined within a workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter, orderBy | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| value | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// OData order by query option. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, string orderBy = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, orderBy, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, null, e => new ServiceWorkspacePolicyFragmentResource(Client, PolicyFragmentContractData.DeserializePolicyFragmentContractData(e)), _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics, Pipeline, "ServiceWorkspacePolicyFragmentCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, format, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, format, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyFragmentResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyFragmentResource.cs new file mode 100644 index 000000000000..09a932bb8b62 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyFragmentResource.cs @@ -0,0 +1,410 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspacePolicyFragment along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspacePolicyFragmentResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspacePolicyFragment method. + /// + public partial class ServiceWorkspacePolicyFragmentResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string id) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics; + private readonly WorkspacePolicyFragmentRestOperations _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient; + private readonly PolicyFragmentContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspacePolicyFragmentResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspacePolicyFragmentResource(ArmClient client, PolicyFragmentContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspacePolicyFragmentResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspacePolicyFragmentWorkspacePolicyFragmentApiVersion); + _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient = new WorkspacePolicyFragmentRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspacePolicyFragmentWorkspacePolicyFragmentApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/policyFragments"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PolicyFragmentContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Get + /// + /// + /// + /// Policy fragment content format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Get + /// + /// + /// + /// Policy fragment content format. + /// The cancellation token to use. + public virtual Response Get(PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyFragmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspacePolicyFragmentOperationSource(Client), _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics, Pipeline, _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy fragment contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, PolicyFragmentContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspacePolicyFragmentOperationSource(Client), _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics, Pipeline, _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists policy resources that reference the policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}/listReferences + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_ListReferences + /// + /// + /// + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetReferencesAsync(int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateListReferencesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ResourceCollectionValueItem.DeserializeResourceCollectionValueItem, _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics, Pipeline, "ServiceWorkspacePolicyFragmentResource.GetReferences", "value", null, cancellationToken); + } + + /// + /// Lists policy resources that reference the policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}/listReferences + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_ListReferences + /// + /// + /// + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetReferences(int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.CreateListReferencesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, null, ResourceCollectionValueItem.DeserializeResourceCollectionValueItem, _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics, Pipeline, "ServiceWorkspacePolicyFragmentResource.GetReferences", "value", null, cancellationToken); + } + + /// + /// Gets the entity state (Etag) version of a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentClientDiagnostics.CreateScope("ServiceWorkspacePolicyFragmentResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyFragmentWorkspacePolicyFragmentRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyResource.cs new file mode 100644 index 000000000000..2cd72c5e5d98 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspacePolicyResource.cs @@ -0,0 +1,364 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspacePolicy along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspacePolicyResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspacePolicy method. + /// + public partial class ServiceWorkspacePolicyResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, PolicyName policyId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics; + private readonly WorkspacePolicyRestOperations _serviceWorkspacePolicyWorkspacePolicyRestClient; + private readonly PolicyContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspacePolicyResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspacePolicyResource(ArmClient client, PolicyContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspacePolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspacePolicyWorkspacePolicyApiVersion); + _serviceWorkspacePolicyWorkspacePolicyRestClient = new WorkspacePolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspacePolicyWorkspacePolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/policies"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PolicyContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyWorkspacePolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyWorkspacePolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspacePolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyWorkspacePolicyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyWorkspacePolicyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyWorkspacePolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspacePolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyWorkspacePolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspacePolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the workspace policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspacePolicyWorkspacePolicyRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the workspace policy specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspacePolicyWorkspacePolicyClientDiagnostics.CreateScope("ServiceWorkspacePolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspacePolicyWorkspacePolicyRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductApiLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductApiLinkCollection.cs new file mode 100644 index 000000000000..8d5c8cf36ca6 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductApiLinkCollection.cs @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceProductApiLinks method from an instance of . + /// + public partial class ServiceWorkspaceProductApiLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics; + private readonly WorkspaceProductApiLinkRestOperations _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceProductApiLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceProductApiLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceProductApiLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceProductApiLinkResource.ResourceType, out string serviceWorkspaceProductApiLinkWorkspaceProductApiLinkApiVersion); + _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient = new WorkspaceProductApiLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceProductApiLinkWorkspaceProductApiLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceProductResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceProductResource.ResourceType), nameof(id)); + } + + /// + /// Adds an API to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string apiLinkId, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string apiLinkId, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the API links associated with a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceProductApiLinkResource(Client, ProductApiLinkContractData.DeserializeProductApiLinkContractData(e)), _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics, Pipeline, "ServiceWorkspaceProductApiLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the API links associated with a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceProductApiLinkResource(Client, ProductApiLinkContractData.DeserializeProductApiLinkContractData(e)), _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics, Pipeline, "ServiceWorkspaceProductApiLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductApiLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductApiLinkResource.cs new file mode 100644 index 000000000000..5a6eca396005 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductApiLinkResource.cs @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceProductApiLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceProductApiLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceProductApiLink method. + /// + public partial class ServiceWorkspaceProductApiLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string apiLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics; + private readonly WorkspaceProductApiLinkRestOperations _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient; + private readonly ProductApiLinkContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceProductApiLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceProductApiLinkResource(ArmClient client, ProductApiLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceProductApiLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceProductApiLinkWorkspaceProductApiLinkApiVersion); + _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient = new WorkspaceProductApiLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceProductApiLinkWorkspaceProductApiLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/products/apiLinks"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ProductApiLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API from the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API from the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ProductApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductApiLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductApiLinkWorkspaceProductApiLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductCollection.cs new file mode 100644 index 000000000000..a0404e3354ac --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductCollection.cs @@ -0,0 +1,352 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceProducts method from an instance of . + /// + public partial class ServiceWorkspaceProductCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceProductWorkspaceProductClientDiagnostics; + private readonly WorkspaceProductRestOperations _serviceWorkspaceProductWorkspaceProductRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceProductCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceProductCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceProductWorkspaceProductClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceProductResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceProductResource.ResourceType, out string serviceWorkspaceProductWorkspaceProductApiVersion); + _serviceWorkspaceProductWorkspaceProductRestClient = new WorkspaceProductRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceProductWorkspaceProductApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or Updates a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string productId, ApiManagementProductData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductWorkspaceProductRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or Updates a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string productId, ApiManagementProductData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductWorkspaceProductRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Get + /// + /// + /// + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductWorkspaceProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Get + /// + /// + /// + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductWorkspaceProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of products in the specified workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products + /// + /// + /// Operation Id + /// WorkspaceProduct_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// When set to true, the response contains an array of groups that have visibility to the product. The default is false. + /// Products which are part of a specific tag. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceProductWorkspaceProductRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, expandGroups, tags); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceProductWorkspaceProductRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, expandGroups, tags); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _serviceWorkspaceProductWorkspaceProductClientDiagnostics, Pipeline, "ServiceWorkspaceProductCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of products in the specified workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products + /// + /// + /// Operation Id + /// WorkspaceProduct_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| terms | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| groups | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// When set to true, the response contains an array of groups that have visibility to the product. The default is false. + /// Products which are part of a specific tag. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, bool? expandGroups = null, string tags = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceProductWorkspaceProductRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, expandGroups, tags); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceProductWorkspaceProductRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, expandGroups, tags); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceProductResource(Client, ApiManagementProductData.DeserializeApiManagementProductData(e)), _serviceWorkspaceProductWorkspaceProductClientDiagnostics, Pipeline, "ServiceWorkspaceProductCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Get + /// + /// + /// + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductWorkspaceProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Get + /// + /// + /// + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string productId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productId, nameof(productId)); + + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductWorkspaceProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, productId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductGroupLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductGroupLinkCollection.cs new file mode 100644 index 000000000000..3807157c3c73 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductGroupLinkCollection.cs @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceProductGroupLinks method from an instance of . + /// + public partial class ServiceWorkspaceProductGroupLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics; + private readonly WorkspaceProductGroupLinkRestOperations _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceProductGroupLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceProductGroupLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceProductGroupLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceProductGroupLinkResource.ResourceType, out string serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkApiVersion); + _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient = new WorkspaceProductGroupLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceProductResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceProductResource.ResourceType), nameof(id)); + } + + /// + /// Adds a group to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string groupLinkId, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, groupLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductGroupLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a group to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string groupLinkId, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, groupLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductGroupLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the group links associated with a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceProductGroupLinkResource(Client, ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(e)), _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics, Pipeline, "ServiceWorkspaceProductGroupLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the group links associated with a product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| groupId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceProductGroupLinkResource(Client, ProductGroupLinkContractData.DeserializeProductGroupLinkContractData(e)), _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics, Pipeline, "ServiceWorkspaceProductGroupLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string groupLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupLinkId, nameof(groupLinkId)); + + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, groupLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductGroupLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductGroupLinkResource.cs new file mode 100644 index 000000000000..1a42a94aa1c0 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductGroupLinkResource.cs @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceProductGroupLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceProductGroupLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceProductGroupLink method. + /// + public partial class ServiceWorkspaceProductGroupLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, string groupLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics; + private readonly WorkspaceProductGroupLinkRestOperations _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient; + private readonly ProductGroupLinkContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceProductGroupLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceProductGroupLinkResource(ArmClient client, ProductGroupLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceProductGroupLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkApiVersion); + _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient = new WorkspaceProductGroupLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/products/groupLinks"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ProductGroupLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductGroupLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified group from the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified group from the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a group to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductGroupLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a group to the specified product via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ProductGroupLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkClientDiagnostics.CreateScope("ServiceWorkspaceProductGroupLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductGroupLinkWorkspaceProductGroupLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductGroupLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductPolicyCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductPolicyCollection.cs new file mode 100644 index 000000000000..5388e816221d --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductPolicyCollection.cs @@ -0,0 +1,325 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceProductPolicies method from an instance of . + /// + public partial class ServiceWorkspaceProductPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics; + private readonly WorkspaceProductPolicyRestOperations _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceProductPolicyCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceProductPolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceProductPolicyResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceProductPolicyResource.ResourceType, out string serviceWorkspaceProductPolicyWorkspaceProductPolicyApiVersion); + _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient = new WorkspaceProductPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceProductPolicyWorkspaceProductPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceProductResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceProductResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates policy configuration for the Product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the Product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The identifier of the Policy. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, PolicyName policyId, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_ListByProduct + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ServiceWorkspaceProductPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics, Pipeline, "ServiceWorkspaceProductPolicyCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Get the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_ListByProduct + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return PageableHelpers.CreatePageable(FirstPageRequest, null, e => new ServiceWorkspaceProductPolicyResource(Client, PolicyContractData.DeserializePolicyContractData(e)), _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics, Pipeline, "ServiceWorkspaceProductPolicyCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> ExistsAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Exists(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, policyId, format, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductPolicyResource.cs new file mode 100644 index 000000000000..059add112bdd --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductPolicyResource.cs @@ -0,0 +1,364 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceProductPolicy along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceProductPolicyResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceProductPolicy method. + /// + public partial class ServiceWorkspaceProductPolicyResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId, PolicyName policyId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics; + private readonly WorkspaceProductPolicyRestOperations _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient; + private readonly PolicyContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceProductPolicyResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceProductPolicyResource(ArmClient client, PolicyContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceProductPolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceProductPolicyWorkspaceProductPolicyApiVersion); + _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient = new WorkspaceProductPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceProductPolicyWorkspaceProductPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/products/policies"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PolicyContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual async Task> GetAsync(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Get + /// + /// + /// + /// Policy Export Format. + /// The cancellation token to use. + public virtual Response Get(PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, format, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the Product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the policy configuration at the Product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the Product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates policy configuration for the Product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The policy contents to apply. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, PolicyContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceProductPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the ETag of the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the ETag of the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductPolicyWorkspaceProductPolicyClientDiagnostics.CreateScope("ServiceWorkspaceProductPolicyResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductPolicyWorkspaceProductPolicyRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductResource.cs new file mode 100644 index 000000000000..61f7b0581054 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceProductResource.cs @@ -0,0 +1,513 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceProduct along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceProductResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceProduct method. + /// + public partial class ServiceWorkspaceProductResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string productId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceProductWorkspaceProductClientDiagnostics; + private readonly WorkspaceProductRestOperations _serviceWorkspaceProductWorkspaceProductRestClient; + private readonly ApiManagementProductData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceProductResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceProductResource(ArmClient client, ApiManagementProductData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceProductResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceProductWorkspaceProductClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceProductWorkspaceProductApiVersion); + _serviceWorkspaceProductWorkspaceProductRestClient = new WorkspaceProductRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceProductWorkspaceProductApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/products"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiManagementProductData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of ServiceWorkspaceProductPolicyResources in the ServiceWorkspaceProduct. + /// An object representing collection of ServiceWorkspaceProductPolicyResources and their operations over a ServiceWorkspaceProductPolicyResource. + public virtual ServiceWorkspaceProductPolicyCollection GetServiceWorkspaceProductPolicies() + { + return GetCachedClient(Client => new ServiceWorkspaceProductPolicyCollection(Client, Id)); + } + + /// + /// Get the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceProductPolicyAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceProductPolicies().GetAsync(policyId, format, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the policy configuration at the Product level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspaceProductPolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceProductPolicy(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceProductPolicies().Get(policyId, format, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceProductApiLinkResources in the ServiceWorkspaceProduct. + /// An object representing collection of ServiceWorkspaceProductApiLinkResources and their operations over a ServiceWorkspaceProductApiLinkResource. + public virtual ServiceWorkspaceProductApiLinkCollection GetServiceWorkspaceProductApiLinks() + { + return GetCachedClient(Client => new ServiceWorkspaceProductApiLinkCollection(Client, Id)); + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceProductApiLinkAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceProductApiLinks().GetAsync(apiLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the API link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductApiLink_Get + /// + /// + /// + /// Product-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceProductApiLink(string apiLinkId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceProductApiLinks().Get(apiLinkId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceProductGroupLinkResources in the ServiceWorkspaceProduct. + /// An object representing collection of ServiceWorkspaceProductGroupLinkResources and their operations over a ServiceWorkspaceProductGroupLinkResource. + public virtual ServiceWorkspaceProductGroupLinkCollection GetServiceWorkspaceProductGroupLinks() + { + return GetCachedClient(Client => new ServiceWorkspaceProductGroupLinkCollection(Client, Id)); + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceProductGroupLinkAsync(string groupLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceProductGroupLinks().GetAsync(groupLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the group link for the product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId}/groupLinks/{groupLinkId} + /// + /// + /// Operation Id + /// WorkspaceProductGroupLink_Get + /// + /// + /// + /// Product-Group link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceProductGroupLink(string groupLinkId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceProductGroupLinks().Get(groupLinkId, cancellationToken); + } + + /// + /// Gets the details of the product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductWorkspaceProductRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductWorkspaceProductRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceProductResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// Delete existing subscriptions associated with the product or not. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, bool? deleteSubscriptions = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductWorkspaceProductRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, deleteSubscriptions, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// Delete existing subscriptions associated with the product or not. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, bool? deleteSubscriptions = null, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductWorkspaceProductRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, deleteSubscriptions, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update existing product details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Update + /// + /// + /// + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, ProductUpdateParameters productUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(productUpdateParameters, nameof(productUpdateParameters)); + + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductWorkspaceProductRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, productUpdateParameters, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceWorkspaceProductResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update existing product details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Update + /// + /// + /// + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, ProductUpdateParameters productUpdateParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(productUpdateParameters, nameof(productUpdateParameters)); + + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductWorkspaceProductRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, productUpdateParameters, cancellationToken); + return Response.FromValue(new ServiceWorkspaceProductResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceProductWorkspaceProductRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceProductWorkspaceProductClientDiagnostics.CreateScope("ServiceWorkspaceProductResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceProductWorkspaceProductRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSchemaCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSchemaCollection.cs new file mode 100644 index 000000000000..84f107e51c0c --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSchemaCollection.cs @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceSchemas method from an instance of . + /// + public partial class ServiceWorkspaceSchemaCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics; + private readonly WorkspaceGlobalSchemaRestOperations _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceSchemaCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceSchemaCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceSchemaResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceSchemaResource.ResourceType, out string serviceWorkspaceSchemaWorkspaceGlobalSchemaApiVersion); + _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient = new WorkspaceGlobalSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceSchemaWorkspaceGlobalSchemaApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates new or updates existing specified Schema of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string schemaId, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceSchemaOperationSource(Client), _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics, Pipeline, _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates new or updates existing specified Schema of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Schema id identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string schemaId, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceSchemaOperationSource(Client), _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics, Pipeline, _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of schemas registered with workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceSchemaResource(Client, ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(e)), _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics, Pipeline, "ServiceWorkspaceSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of schemas registered with workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceSchemaResource(Client, ApiManagementGlobalSchemaData.DeserializeApiManagementGlobalSchemaData(e)), _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics, Pipeline, "ServiceWorkspaceSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string schemaId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schemaId, nameof(schemaId)); + + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, schemaId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSchemaResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSchemaResource.cs new file mode 100644 index 000000000000..f3c134181e6b --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSchemaResource.cs @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceSchema along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceSchemaResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceSchema method. + /// + public partial class ServiceWorkspaceSchemaResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string schemaId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics; + private readonly WorkspaceGlobalSchemaRestOperations _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient; + private readonly ApiManagementGlobalSchemaData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceSchemaResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceSchemaResource(ArmClient client, ApiManagementGlobalSchemaData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceSchemaResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceSchemaWorkspaceGlobalSchemaApiVersion); + _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient = new WorkspaceGlobalSchemaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceSchemaWorkspaceGlobalSchemaApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/schemas"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ApiManagementGlobalSchemaData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the Schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the Schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific Schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific Schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates new or updates existing specified Schema of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceSchemaOperationSource(Client), _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics, Pipeline, _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates new or updates existing specified Schema of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ApiManagementGlobalSchemaData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(new ServiceWorkspaceSchemaOperationSource(Client), _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics, Pipeline, _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the Schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSchemaWorkspaceGlobalSchemaClientDiagnostics.CreateScope("ServiceWorkspaceSchemaResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceSchemaWorkspaceGlobalSchemaRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSubscriptionCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSubscriptionCollection.cs new file mode 100644 index 000000000000..5bb72c8bd607 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSubscriptionCollection.cs @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceSubscriptions method from an instance of . + /// + public partial class ServiceWorkspaceSubscriptionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics; + private readonly WorkspaceSubscriptionRestOperations _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceSubscriptionCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceSubscriptionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceSubscriptionResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceSubscriptionResource.ResourceType, out string serviceWorkspaceSubscriptionWorkspaceSubscriptionApiVersion); + _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient = new WorkspaceSubscriptionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceSubscriptionWorkspaceSubscriptionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates the subscription of specified user to the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// Create parameters. + /// + /// 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 + /// + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// Determines the type of application which send the create user request. Default is legacy publisher portal. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + Argument.AssertNotNull(subscriptionCreateParameters, nameof(subscriptionCreateParameters)); + + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sid, subscriptionCreateParameters, notify, ifMatch, appType, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceSubscriptionResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates the subscription of specified user to the specified product. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// Create parameters. + /// + /// 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 + /// + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// Determines the type of application which send the create user request. Default is legacy publisher portal. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string sid, SubscriptionCreateParameters subscriptionCreateParameters, bool? notify = null, ETag? ifMatch = null, AppType? appType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + Argument.AssertNotNull(subscriptionCreateParameters, nameof(subscriptionCreateParameters)); + + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sid, subscriptionCreateParameters, notify, ifMatch, appType, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceSubscriptionResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified Subscription entity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Get + /// + /// + /// + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sid, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified Subscription entity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Get + /// + /// + /// + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sid, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all subscriptions of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions + /// + /// + /// Operation Id + /// WorkspaceSubscription_List + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceSubscriptionResource(Client, SubscriptionContractData.DeserializeSubscriptionContractData(e)), _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics, Pipeline, "ServiceWorkspaceSubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all subscriptions of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions + /// + /// + /// Operation Id + /// WorkspaceSubscription_List + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| state | filter | eq | |</br>| user | expand | | |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceSubscriptionResource(Client, SubscriptionContractData.DeserializeSubscriptionContractData(e)), _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics, Pipeline, "ServiceWorkspaceSubscriptionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Get + /// + /// + /// + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sid, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Get + /// + /// + /// + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string sid, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sid, nameof(sid)); + + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, sid, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSubscriptionResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSubscriptionResource.cs new file mode 100644 index 000000000000..00e7aa42d2c2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceSubscriptionResource.cs @@ -0,0 +1,546 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceSubscription along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceSubscriptionResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceSubscription method. + /// + public partial class ServiceWorkspaceSubscriptionResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string sid) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics; + private readonly WorkspaceSubscriptionRestOperations _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient; + private readonly SubscriptionContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceSubscriptionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceSubscriptionResource(ArmClient client, SubscriptionContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceSubscriptionWorkspaceSubscriptionApiVersion); + _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient = new WorkspaceSubscriptionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceSubscriptionWorkspaceSubscriptionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/subscriptions"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual SubscriptionContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the specified Subscription entity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified Subscription entity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of a subscription specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Update + /// + /// + /// + /// 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. + /// Update parameters. + /// + /// 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 + /// + /// Determines the type of application which send the create user request. Default is legacy publisher portal. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionUpdateParameters, nameof(subscriptionUpdateParameters)); + + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, subscriptionUpdateParameters, notify, appType, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceWorkspaceSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of a subscription specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Update + /// + /// + /// + /// 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. + /// Update parameters. + /// + /// 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 + /// + /// Determines the type of application which send the create user request. Default is legacy publisher portal. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, SubscriptionUpdateParameters subscriptionUpdateParameters, bool? notify = null, AppType? appType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionUpdateParameters, nameof(subscriptionUpdateParameters)); + + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, subscriptionUpdateParameters, notify, appType, cancellationToken); + return Response.FromValue(new ServiceWorkspaceSubscriptionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Regenerates primary key of existing subscription of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/regeneratePrimaryKey + /// + /// + /// Operation Id + /// WorkspaceSubscription_RegeneratePrimaryKey + /// + /// + /// + /// The cancellation token to use. + public virtual async Task RegeneratePrimaryKeyAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.RegeneratePrimaryKey"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.RegeneratePrimaryKeyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Regenerates primary key of existing subscription of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/regeneratePrimaryKey + /// + /// + /// Operation Id + /// WorkspaceSubscription_RegeneratePrimaryKey + /// + /// + /// + /// The cancellation token to use. + public virtual Response RegeneratePrimaryKey(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.RegeneratePrimaryKey"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.RegeneratePrimaryKey(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Regenerates secondary key of existing subscription of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/regenerateSecondaryKey + /// + /// + /// Operation Id + /// WorkspaceSubscription_RegenerateSecondaryKey + /// + /// + /// + /// The cancellation token to use. + public virtual async Task RegenerateSecondaryKeyAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.RegenerateSecondaryKey"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.RegenerateSecondaryKeyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Regenerates secondary key of existing subscription of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/regenerateSecondaryKey + /// + /// + /// Operation Id + /// WorkspaceSubscription_RegenerateSecondaryKey + /// + /// + /// + /// The cancellation token to use. + public virtual Response RegenerateSecondaryKey(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.RegenerateSecondaryKey"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.RegenerateSecondaryKey(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified Subscription keys. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/listSecrets + /// + /// + /// Operation Id + /// WorkspaceSubscription_ListSecrets + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetSecretsAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.GetSecrets"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.ListSecretsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified Subscription keys. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid}/listSecrets + /// + /// + /// Operation Id + /// WorkspaceSubscription_ListSecrets + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetSecrets(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.GetSecrets"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.ListSecrets(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceSubscriptionWorkspaceSubscriptionClientDiagnostics.CreateScope("ServiceWorkspaceSubscriptionResource.GetEntityTag"); + scope.Start(); + try + { + var response = _serviceWorkspaceSubscriptionWorkspaceSubscriptionRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagApiLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagApiLinkCollection.cs new file mode 100644 index 000000000000..1d22aa7392a1 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagApiLinkCollection.cs @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceTagApiLinks method from an instance of . + /// + public partial class ServiceWorkspaceTagApiLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics; + private readonly WorkspaceTagApiLinkRestOperations _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceTagApiLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceTagApiLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceTagApiLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceTagApiLinkResource.ResourceType, out string serviceWorkspaceTagApiLinkWorkspaceTagApiLinkApiVersion); + _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient = new WorkspaceTagApiLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceTagApiLinkWorkspaceTagApiLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceTagResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceTagResource.ResourceType), nameof(id)); + } + + /// + /// Adds an API to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string apiLinkId, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string apiLinkId, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the API links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceTagApiLinkResource(Client, TagApiLinkContractData.DeserializeTagApiLinkContractData(e)), _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics, Pipeline, "ServiceWorkspaceTagApiLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the API links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| apiId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceTagApiLinkResource(Client, TagApiLinkContractData.DeserializeTagApiLinkContractData(e)), _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics, Pipeline, "ServiceWorkspaceTagApiLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string apiLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(apiLinkId, nameof(apiLinkId)); + + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, apiLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagApiLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagApiLinkResource.cs new file mode 100644 index 000000000000..1bb6a486d1d3 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagApiLinkResource.cs @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceTagApiLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceTagApiLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceTagApiLink method. + /// + public partial class ServiceWorkspaceTagApiLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string apiLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics; + private readonly WorkspaceTagApiLinkRestOperations _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient; + private readonly TagApiLinkContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceTagApiLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceTagApiLinkResource(ArmClient client, TagApiLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceTagApiLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceTagApiLinkWorkspaceTagApiLinkApiVersion); + _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient = new WorkspaceTagApiLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceTagApiLinkWorkspaceTagApiLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/tags/apiLinks"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual TagApiLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagApiLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified API from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an API to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, TagApiLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagApiLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagApiLinkWorkspaceTagApiLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagApiLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagCollection.cs new file mode 100644 index 000000000000..b4ec3e214be1 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagCollection.cs @@ -0,0 +1,351 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceTags method from an instance of . + /// + public partial class ServiceWorkspaceTagCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceTagWorkspaceTagClientDiagnostics; + private readonly WorkspaceTagRestOperations _serviceWorkspaceTagWorkspaceTagRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceTagCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceTagCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceTagWorkspaceTagClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceTagResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceTagResource.ResourceType, out string serviceWorkspaceTagWorkspaceTagApiVersion); + _serviceWorkspaceTagWorkspaceTagRestClient = new WorkspaceTagRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceTagWorkspaceTagApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkspaceContractResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkspaceContractResource.ResourceType), nameof(id)); + } + + /// + /// Creates a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string tagId, ApiManagementTagCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagWorkspaceTagRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagId, content, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string tagId, ApiManagementTagCreateOrUpdateContent content, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagWorkspaceTagRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagId, content, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Get + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagWorkspaceTagRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Get + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagWorkspaceTagRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of tags defined within a workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags + /// + /// + /// Operation Id + /// WorkspaceTag_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Scope like 'apis', 'products' or 'apis/{apiId}. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, string scope = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceTagWorkspaceTagRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, scope); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceTagWorkspaceTagRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, scope); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceTagResource(Client, TagContractData.DeserializeTagContractData(e)), _serviceWorkspaceTagWorkspaceTagClientDiagnostics, Pipeline, "ServiceWorkspaceTagCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of tags defined within a workspace in a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags + /// + /// + /// Operation Id + /// WorkspaceTag_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// Scope like 'apis', 'products' or 'apis/{apiId}. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, string scope = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceTagWorkspaceTagRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, scope); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceTagWorkspaceTagRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter, top, skip, scope); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceTagResource(Client, TagContractData.DeserializeTagContractData(e)), _serviceWorkspaceTagWorkspaceTagClientDiagnostics, Pipeline, "ServiceWorkspaceTagCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Get + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagWorkspaceTagRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Get + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string tagId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(tagId, nameof(tagId)); + + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagWorkspaceTagRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagOperationLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagOperationLinkCollection.cs new file mode 100644 index 000000000000..c33660f5c05c --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagOperationLinkCollection.cs @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceTagOperationLinks method from an instance of . + /// + public partial class ServiceWorkspaceTagOperationLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics; + private readonly WorkspaceTagOperationLinkRestOperations _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceTagOperationLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceTagOperationLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceTagOperationLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceTagOperationLinkResource.ResourceType, out string serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkApiVersion); + _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient = new WorkspaceTagOperationLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceTagResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceTagResource.ResourceType), nameof(id)); + } + + /// + /// Adds an operation to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string operationLinkId, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagOperationLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an operation to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string operationLinkId, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagOperationLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the operation links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceTagOperationLinkResource(Client, TagOperationLinkContractData.DeserializeTagOperationLinkContractData(e)), _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics, Pipeline, "ServiceWorkspaceTagOperationLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the operation links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| operationId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceTagOperationLinkResource(Client, TagOperationLinkContractData.DeserializeTagOperationLinkContractData(e)), _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics, Pipeline, "ServiceWorkspaceTagOperationLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string operationLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationLinkId, nameof(operationLinkId)); + + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, operationLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagOperationLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagOperationLinkResource.cs new file mode 100644 index 000000000000..532d0229993e --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagOperationLinkResource.cs @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceTagOperationLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceTagOperationLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceTagOperationLink method. + /// + public partial class ServiceWorkspaceTagOperationLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string operationLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics; + private readonly WorkspaceTagOperationLinkRestOperations _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient; + private readonly TagOperationLinkContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceTagOperationLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceTagOperationLinkResource(ArmClient client, TagOperationLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceTagOperationLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkApiVersion); + _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient = new WorkspaceTagOperationLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/tags/operationLinks"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual TagOperationLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagOperationLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified operation from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified operation from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an operation to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagOperationLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an operation to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, TagOperationLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagOperationLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagOperationLinkWorkspaceTagOperationLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagOperationLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagProductLinkCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagProductLinkCollection.cs new file mode 100644 index 000000000000..c253c78051ee --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagProductLinkCollection.cs @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetServiceWorkspaceTagProductLinks method from an instance of . + /// + public partial class ServiceWorkspaceTagProductLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics; + private readonly WorkspaceTagProductLinkRestOperations _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceTagProductLinkCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ServiceWorkspaceTagProductLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ServiceWorkspaceTagProductLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceWorkspaceTagProductLinkResource.ResourceType, out string serviceWorkspaceTagProductLinkWorkspaceTagProductLinkApiVersion); + _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient = new WorkspaceTagProductLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceTagProductLinkWorkspaceTagProductLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ServiceWorkspaceTagResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ServiceWorkspaceTagResource.ResourceType), nameof(id)); + } + + /// + /// Adds a product to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string productLinkId, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, productLinkId, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagProductLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a product to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// Create or update parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string productLinkId, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, productLinkId, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagProductLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkCollection.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, productLinkId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkCollection.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, productLinkId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of the product links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceTagProductLinkResource(Client, TagProductLinkContractData.DeserializeTagProductLinkContractData(e)), _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics, Pipeline, "ServiceWorkspaceTagProductLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of the product links associated with a tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_ListByProduct + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.CreateListByProductRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.CreateListByProductNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceWorkspaceTagProductLinkResource(Client, TagProductLinkContractData.DeserializeTagProductLinkContractData(e)), _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics, Pipeline, "ServiceWorkspaceTagProductLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, productLinkId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string productLinkId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(productLinkId, nameof(productLinkId)); + + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkCollection.Exists"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, productLinkId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagProductLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagProductLinkResource.cs new file mode 100644 index 000000000000..0e4a73ab146b --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagProductLinkResource.cs @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceTagProductLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceTagProductLinkResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceTagProductLink method. + /// + public partial class ServiceWorkspaceTagProductLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId, string productLinkId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics; + private readonly WorkspaceTagProductLinkRestOperations _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient; + private readonly TagProductLinkContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceTagProductLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceTagProductLinkResource(ArmClient client, TagProductLinkContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceTagProductLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceTagProductLinkWorkspaceTagProductLinkApiVersion); + _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient = new WorkspaceTagProductLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceTagProductLinkWorkspaceTagProductLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/tags/productLinks"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual TagProductLinkContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagProductLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified product from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified product from the specified tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a product to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagProductLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds a product to the specified tag via link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Create or update parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, TagProductLinkContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkClientDiagnostics.CreateScope("ServiceWorkspaceTagProductLinkResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagProductLinkWorkspaceTagProductLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new ServiceWorkspaceTagProductLinkResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagResource.cs new file mode 100644 index 000000000000..7913c9520fbe --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ServiceWorkspaceTagResource.cs @@ -0,0 +1,513 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a ServiceWorkspaceTag along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetServiceWorkspaceTagResource method. + /// Otherwise you can get one from its parent resource using the GetServiceWorkspaceTag method. + /// + public partial class ServiceWorkspaceTagResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId, string tagId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceWorkspaceTagWorkspaceTagClientDiagnostics; + private readonly WorkspaceTagRestOperations _serviceWorkspaceTagWorkspaceTagRestClient; + private readonly TagContractData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceWorkspaceTagResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceWorkspaceTagResource(ArmClient client, TagContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ServiceWorkspaceTagResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceWorkspaceTagWorkspaceTagClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceWorkspaceTagWorkspaceTagApiVersion); + _serviceWorkspaceTagWorkspaceTagRestClient = new WorkspaceTagRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceWorkspaceTagWorkspaceTagApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces/tags"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual TagContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of ServiceWorkspaceTagApiLinkResources in the ServiceWorkspaceTag. + /// An object representing collection of ServiceWorkspaceTagApiLinkResources and their operations over a ServiceWorkspaceTagApiLinkResource. + public virtual ServiceWorkspaceTagApiLinkCollection GetServiceWorkspaceTagApiLinks() + { + return GetCachedClient(Client => new ServiceWorkspaceTagApiLinkCollection(Client, Id)); + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceTagApiLinkAsync(string apiLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceTagApiLinks().GetAsync(apiLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the API link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/apiLinks/{apiLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagApiLink_Get + /// + /// + /// + /// Tag-API link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceTagApiLink(string apiLinkId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceTagApiLinks().Get(apiLinkId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceTagOperationLinkResources in the ServiceWorkspaceTag. + /// An object representing collection of ServiceWorkspaceTagOperationLinkResources and their operations over a ServiceWorkspaceTagOperationLinkResource. + public virtual ServiceWorkspaceTagOperationLinkCollection GetServiceWorkspaceTagOperationLinks() + { + return GetCachedClient(Client => new ServiceWorkspaceTagOperationLinkCollection(Client, Id)); + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceTagOperationLinkAsync(string operationLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceTagOperationLinks().GetAsync(operationLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the operation link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/operationLinks/{operationLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagOperationLink_Get + /// + /// + /// + /// Tag-operation link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceTagOperationLink(string operationLinkId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceTagOperationLinks().Get(operationLinkId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceTagProductLinkResources in the ServiceWorkspaceTag. + /// An object representing collection of ServiceWorkspaceTagProductLinkResources and their operations over a ServiceWorkspaceTagProductLinkResource. + public virtual ServiceWorkspaceTagProductLinkCollection GetServiceWorkspaceTagProductLinks() + { + return GetCachedClient(Client => new ServiceWorkspaceTagProductLinkCollection(Client, Id)); + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceTagProductLinkAsync(string productLinkId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceTagProductLinks().GetAsync(productLinkId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the product link for the tag. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId}/productLinks/{productLinkId} + /// + /// + /// Operation Id + /// WorkspaceTagProductLink_Get + /// + /// + /// + /// Tag-product link identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceTagProductLink(string productLinkId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceTagProductLinks().Get(productLinkId, cancellationToken); + } + + /// + /// Gets the details of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagResource.Get"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagWorkspaceTagRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagResource.Get"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagWorkspaceTagRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceWorkspaceTagResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific tag of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagResource.Delete"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagWorkspaceTagRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes specific tag of the workspace in an API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagResource.Delete"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagWorkspaceTagRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Update + /// + /// + /// + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, ApiManagementTagCreateOrUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagResource.Update"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagWorkspaceTagRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, content, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceWorkspaceTagResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Update + /// + /// + /// + /// 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. + /// Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, ApiManagementTagCreateOrUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagResource.Update"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagWorkspaceTagRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, content, cancellationToken); + return Response.FromValue(new ServiceWorkspaceTagResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state version of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_GetEntityState + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityStateAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagResource.GetEntityState"); + scope.Start(); + try + { + var response = await _serviceWorkspaceTagWorkspaceTagRestClient.GetEntityStateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state version of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_GetEntityState + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityState(CancellationToken cancellationToken = default) + { + using var scope = _serviceWorkspaceTagWorkspaceTagClientDiagnostics.CreateScope("ServiceWorkspaceTagResource.GetEntityState"); + scope.Start(); + try + { + var response = _serviceWorkspaceTagWorkspaceTagRestClient.GetEntityState(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagApiLinkContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagApiLinkContractData.cs new file mode 100644 index 000000000000..c4addf704f4c --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagApiLinkContractData.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the TagApiLinkContract data model. + /// Tag-API link details. + /// + public partial class TagApiLinkContractData : ResourceData + { + /// Initializes a new instance of TagApiLinkContractData. + public TagApiLinkContractData() + { + } + + /// Initializes a new instance of TagApiLinkContractData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Full resource Id of an API. + internal TagApiLinkContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string apiId) : base(id, name, resourceType, systemData) + { + ApiId = apiId; + } + + /// Full resource Id of an API. + public string ApiId { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagOperationLinkContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagOperationLinkContractData.cs new file mode 100644 index 000000000000..83f0ceb8d0bf --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagOperationLinkContractData.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the TagOperationLinkContract data model. + /// Tag-operation link details. + /// + public partial class TagOperationLinkContractData : ResourceData + { + /// Initializes a new instance of TagOperationLinkContractData. + public TagOperationLinkContractData() + { + } + + /// Initializes a new instance of TagOperationLinkContractData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Full resource Id of an API operation. + internal TagOperationLinkContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string operationId) : base(id, name, resourceType, systemData) + { + OperationId = operationId; + } + + /// Full resource Id of an API operation. + public string OperationId { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagProductLinkContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagProductLinkContractData.cs new file mode 100644 index 000000000000..81930e505edc --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TagProductLinkContractData.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the TagProductLinkContract data model. + /// Tag-product link details. + /// + public partial class TagProductLinkContractData : ResourceData + { + /// Initializes a new instance of TagProductLinkContractData. + public TagProductLinkContractData() + { + } + + /// Initializes a new instance of TagProductLinkContractData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Full resource Id of a product. + internal TagProductLinkContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string productId) : base(id, name, resourceType, systemData) + { + ProductId = productId; + } + + /// Full resource Id of a product. + public string ProductId { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WikiContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WikiContractData.cs new file mode 100644 index 000000000000..33883aed0626 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WikiContractData.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ApiManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the WikiContract data model. + /// Wiki properties + /// + public partial class WikiContractData : ResourceData + { + /// Initializes a new instance of WikiContractData. + public WikiContractData() + { + Documents = new ChangeTrackingList(); + } + + /// Initializes a new instance of WikiContractData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Collection wiki documents included into this wiki. + internal WikiContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList documents) : base(id, name, resourceType, systemData) + { + Documents = documents; + } + + /// Collection wiki documents included into this wiki. + public IList Documents { get; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WorkspaceContractCollection.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WorkspaceContractCollection.cs new file mode 100644 index 000000000000..d7262f678f04 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WorkspaceContractCollection.cs @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetWorkspaceContracts method from an instance of . + /// + public partial class WorkspaceContractCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _workspaceContractWorkspaceClientDiagnostics; + private readonly WorkspaceRestOperations _workspaceContractWorkspaceRestClient; + + /// Initializes a new instance of the class for mocking. + protected WorkspaceContractCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal WorkspaceContractCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _workspaceContractWorkspaceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", WorkspaceContractResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(WorkspaceContractResource.ResourceType, out string workspaceContractWorkspaceApiVersion); + _workspaceContractWorkspaceRestClient = new WorkspaceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workspaceContractWorkspaceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ApiManagementServiceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ApiManagementServiceResource.ResourceType), nameof(id)); + } + + /// + /// Creates a new workspace or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string workspaceId, WorkspaceContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _workspaceContractWorkspaceRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workspaceId, data, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(Response.FromValue(new WorkspaceContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new workspace or updates an existing one. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Workspace identifier. Must be unique in the current API Management service instance. + /// Create parameters. + /// ETag of the Entity. Not required when creating an entity, but required when updating an entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string workspaceId, WorkspaceContractData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _workspaceContractWorkspaceRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workspaceId, data, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(Response.FromValue(new WorkspaceContractResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Get + /// + /// + /// + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractCollection.Get"); + scope.Start(); + try + { + var response = await _workspaceContractWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workspaceId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkspaceContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Get + /// + /// + /// + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractCollection.Get"); + scope.Start(); + try + { + var response = _workspaceContractWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workspaceId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkspaceContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all workspaces of the API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces + /// + /// + /// Operation Id + /// Workspace_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br></br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceContractWorkspaceRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workspaceContractWorkspaceRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkspaceContractResource(Client, WorkspaceContractData.DeserializeWorkspaceContractData(e)), _workspaceContractWorkspaceClientDiagnostics, Pipeline, "WorkspaceContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all workspaces of the API Management service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces + /// + /// + /// Operation Id + /// Workspace_ListByService + /// + /// + /// + /// | Field | Usage | Supported operators | Supported functions |</br>|-------------|-------------|-------------|-------------|</br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br></br>| description | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |</br>. + /// Number of records to return. + /// Number of records to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workspaceContractWorkspaceRestClient.CreateListByServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workspaceContractWorkspaceRestClient.CreateListByServiceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkspaceContractResource(Client, WorkspaceContractData.DeserializeWorkspaceContractData(e)), _workspaceContractWorkspaceClientDiagnostics, Pipeline, "WorkspaceContractCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Get + /// + /// + /// + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractCollection.Exists"); + scope.Start(); + try + { + var response = await _workspaceContractWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workspaceId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Get + /// + /// + /// + /// Workspace identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string workspaceId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceId, nameof(workspaceId)); + + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractCollection.Exists"); + scope.Start(); + try + { + var response = _workspaceContractWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, workspaceId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WorkspaceContractData.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WorkspaceContractData.cs new file mode 100644 index 000000000000..520069b260d0 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WorkspaceContractData.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A class representing the WorkspaceContract data model. + /// Workspace details. + /// + public partial class WorkspaceContractData : ResourceData + { + /// Initializes a new instance of WorkspaceContractData. + public WorkspaceContractData() + { + } + + /// Initializes a new instance of WorkspaceContractData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Name of the workspace. + /// Description of the workspace. + internal WorkspaceContractData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, string description) : base(id, name, resourceType, systemData) + { + DisplayName = displayName; + Description = description; + } + + /// Name of the workspace. + public string DisplayName { get; set; } + /// Description of the workspace. + public string Description { get; set; } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WorkspaceContractResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WorkspaceContractResource.cs new file mode 100644 index 000000000000..a4b7b6c6a635 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/WorkspaceContractResource.cs @@ -0,0 +1,933 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement +{ + /// + /// A Class representing a WorkspaceContract along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetWorkspaceContractResource method. + /// Otherwise you can get one from its parent resource using the GetWorkspaceContract method. + /// + public partial class WorkspaceContractResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string workspaceId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _workspaceContractWorkspaceClientDiagnostics; + private readonly WorkspaceRestOperations _workspaceContractWorkspaceRestClient; + private readonly WorkspaceContractData _data; + + /// Initializes a new instance of the class for mocking. + protected WorkspaceContractResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal WorkspaceContractResource(ArmClient client, WorkspaceContractData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal WorkspaceContractResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _workspaceContractWorkspaceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string workspaceContractWorkspaceApiVersion); + _workspaceContractWorkspaceRestClient = new WorkspaceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workspaceContractWorkspaceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ApiManagement/service/workspaces"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual WorkspaceContractData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of ServiceWorkspaceApiResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspaceApiResources and their operations over a ServiceWorkspaceApiResource. + public virtual ServiceWorkspaceApiCollection GetServiceWorkspaceApis() + { + return GetCachedClient(Client => new ServiceWorkspaceApiCollection(Client, Id)); + } + + /// + /// Gets the details of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Get + /// + /// + /// + /// 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. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceApiAsync(string apiId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceApis().GetAsync(apiId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the API specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apis/{apiId} + /// + /// + /// Operation Id + /// WorkspaceApi_Get + /// + /// + /// + /// 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. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceApi(string apiId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceApis().Get(apiId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspacePolicyResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspacePolicyResources and their operations over a ServiceWorkspacePolicyResource. + public virtual ServiceWorkspacePolicyCollection GetServiceWorkspacePolicies() + { + return GetCachedClient(Client => new ServiceWorkspacePolicyCollection(Client, Id)); + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspacePolicyAsync(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspacePolicies().GetAsync(policyId, format, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the policy configuration at the API level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/{policyId} + /// + /// + /// Operation Id + /// WorkspacePolicy_Get + /// + /// + /// + /// The identifier of the Policy. + /// Policy Export Format. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspacePolicy(PolicyName policyId, PolicyExportFormat? format = null, CancellationToken cancellationToken = default) + { + return GetServiceWorkspacePolicies().Get(policyId, format, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceTagResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspaceTagResources and their operations over a ServiceWorkspaceTagResource. + public virtual ServiceWorkspaceTagCollection GetServiceWorkspaceTags() + { + return GetCachedClient(Client => new ServiceWorkspaceTagCollection(Client, Id)); + } + + /// + /// Gets the details of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Get + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceTagAsync(string tagId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceTags().GetAsync(tagId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the tag specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/tags/{tagId} + /// + /// + /// Operation Id + /// WorkspaceTag_Get + /// + /// + /// + /// Tag identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceTag(string tagId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceTags().Get(tagId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceApiVersionSetResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspaceApiVersionSetResources and their operations over a ServiceWorkspaceApiVersionSetResource. + public virtual ServiceWorkspaceApiVersionSetCollection GetServiceWorkspaceApiVersionSets() + { + return GetCachedClient(Client => new ServiceWorkspaceApiVersionSetCollection(Client, Id)); + } + + /// + /// Gets the details of the Api Version Set specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Get + /// + /// + /// + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceApiVersionSetAsync(string versionSetId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceApiVersionSets().GetAsync(versionSetId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the Api Version Set specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/apiVersionSets/{versionSetId} + /// + /// + /// Operation Id + /// WorkspaceApiVersionSet_Get + /// + /// + /// + /// Api Version Set identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceApiVersionSet(string versionSetId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceApiVersionSets().Get(versionSetId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceGroupResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspaceGroupResources and their operations over a ServiceWorkspaceGroupResource. + public virtual ServiceWorkspaceGroupCollection GetServiceWorkspaceGroups() + { + return GetCachedClient(Client => new ServiceWorkspaceGroupCollection(Client, Id)); + } + + /// + /// Gets the details of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Get + /// + /// + /// + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceGroupAsync(string groupId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceGroups().GetAsync(groupId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the group specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/groups/{groupId} + /// + /// + /// Operation Id + /// WorkspaceGroup_Get + /// + /// + /// + /// Group identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceGroup(string groupId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceGroups().Get(groupId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceNamedValueResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspaceNamedValueResources and their operations over a ServiceWorkspaceNamedValueResource. + public virtual ServiceWorkspaceNamedValueCollection GetServiceWorkspaceNamedValues() + { + return GetCachedClient(Client => new ServiceWorkspaceNamedValueCollection(Client, Id)); + } + + /// + /// Gets the details of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Get + /// + /// + /// + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceNamedValueAsync(string namedValueId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceNamedValues().GetAsync(namedValueId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the named value specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/namedValues/{namedValueId} + /// + /// + /// Operation Id + /// WorkspaceNamedValue_Get + /// + /// + /// + /// Identifier of the NamedValue. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceNamedValue(string namedValueId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceNamedValues().Get(namedValueId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceNotificationResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspaceNotificationResources and their operations over a ServiceWorkspaceNotificationResource. + public virtual ServiceWorkspaceNotificationCollection GetServiceWorkspaceNotifications() + { + return GetCachedClient(Client => new ServiceWorkspaceNotificationCollection(Client, Id)); + } + + /// + /// Gets the details of the Notification specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_Get + /// + /// + /// + /// Notification Name Identifier. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceNotificationAsync(NotificationName notificationName, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceNotifications().GetAsync(notificationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the Notification specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/notifications/{notificationName} + /// + /// + /// Operation Id + /// WorkspaceNotification_Get + /// + /// + /// + /// Notification Name Identifier. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceNotification(NotificationName notificationName, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceNotifications().Get(notificationName, cancellationToken); + } + + /// Gets a collection of ServiceWorkspacePolicyFragmentResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspacePolicyFragmentResources and their operations over a ServiceWorkspacePolicyFragmentResource. + public virtual ServiceWorkspacePolicyFragmentCollection GetServiceWorkspacePolicyFragments() + { + return GetCachedClient(Client => new ServiceWorkspacePolicyFragmentCollection(Client, Id)); + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspacePolicyFragmentAsync(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspacePolicyFragments().GetAsync(id, format, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a policy fragment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id} + /// + /// + /// Operation Id + /// WorkspacePolicyFragment_Get + /// + /// + /// + /// A resource identifier. + /// Policy fragment content format. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspacePolicyFragment(string id, PolicyFragmentContentFormat? format = null, CancellationToken cancellationToken = default) + { + return GetServiceWorkspacePolicyFragments().Get(id, format, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceProductResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspaceProductResources and their operations over a ServiceWorkspaceProductResource. + public virtual ServiceWorkspaceProductCollection GetServiceWorkspaceProducts() + { + return GetCachedClient(Client => new ServiceWorkspaceProductCollection(Client, Id)); + } + + /// + /// Gets the details of the product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Get + /// + /// + /// + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceProductAsync(string productId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceProducts().GetAsync(productId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the product specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/products/{productId} + /// + /// + /// Operation Id + /// WorkspaceProduct_Get + /// + /// + /// + /// Product identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceProduct(string productId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceProducts().Get(productId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceSchemaResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspaceSchemaResources and their operations over a ServiceWorkspaceSchemaResource. + public virtual ServiceWorkspaceSchemaCollection GetServiceWorkspaceSchemas() + { + return GetCachedClient(Client => new ServiceWorkspaceSchemaCollection(Client, Id)); + } + + /// + /// Gets the details of the Schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceSchemaAsync(string schemaId, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceSchemas().GetAsync(schemaId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the Schema specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/schemas/{schemaId} + /// + /// + /// Operation Id + /// WorkspaceGlobalSchema_Get + /// + /// + /// + /// Schema id identifier. Must be unique in the current API Management service instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceSchema(string schemaId, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceSchemas().Get(schemaId, cancellationToken); + } + + /// Gets a collection of ServiceWorkspaceSubscriptionResources in the WorkspaceContract. + /// An object representing collection of ServiceWorkspaceSubscriptionResources and their operations over a ServiceWorkspaceSubscriptionResource. + public virtual ServiceWorkspaceSubscriptionCollection GetServiceWorkspaceSubscriptions() + { + return GetCachedClient(Client => new ServiceWorkspaceSubscriptionCollection(Client, Id)); + } + + /// + /// Gets the specified Subscription entity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Get + /// + /// + /// + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceWorkspaceSubscriptionAsync(string sid, CancellationToken cancellationToken = default) + { + return await GetServiceWorkspaceSubscriptions().GetAsync(sid, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified Subscription entity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/subscriptions/{sid} + /// + /// + /// Operation Id + /// WorkspaceSubscription_Get + /// + /// + /// + /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceWorkspaceSubscription(string sid, CancellationToken cancellationToken = default) + { + return GetServiceWorkspaceSubscriptions().Get(sid, cancellationToken); + } + + /// + /// Gets the details of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractResource.Get"); + scope.Start(); + try + { + var response = await _workspaceContractWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkspaceContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractResource.Get"); + scope.Start(); + try + { + var response = _workspaceContractWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkspaceContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractResource.Delete"); + scope.Start(); + try + { + var response = await _workspaceContractWorkspaceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag ifMatch, CancellationToken cancellationToken = default) + { + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractResource.Delete"); + scope.Start(); + try + { + var response = _workspaceContractWorkspaceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ApiManagementArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Update + /// + /// + /// + /// 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. + /// Workspace Update parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ETag ifMatch, WorkspaceContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractResource.Update"); + scope.Start(); + try + { + var response = await _workspaceContractWorkspaceRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new WorkspaceContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_Update + /// + /// + /// + /// 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. + /// Workspace Update parameters. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ETag ifMatch, WorkspaceContractData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractResource.Update"); + scope.Start(); + try + { + var response = _workspaceContractWorkspaceRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, data, cancellationToken); + return Response.FromValue(new WorkspaceContractResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetEntityTagAsync(CancellationToken cancellationToken = default) + { + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractResource.GetEntityTag"); + scope.Start(); + try + { + var response = await _workspaceContractWorkspaceRestClient.GetEntityTagAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the entity state (Etag) version of the workspace specified by its identifier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId} + /// + /// + /// Operation Id + /// Workspace_GetEntityTag + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetEntityTag(CancellationToken cancellationToken = default) + { + using var scope = _workspaceContractWorkspaceClientDiagnostics.CreateScope("WorkspaceContractResource.GetEntityTag"); + scope.Start(); + try + { + var response = _workspaceContractWorkspaceRestClient.GetEntityTag(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/autorest.md b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/autorest.md index 68d79edfef0e..80b89ee13e81 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/autorest.md +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/autorest.md @@ -9,7 +9,7 @@ generate-model-factory: false csharp: true library-name: ApiManagement namespace: Azure.ResourceManager.ApiManagement -require: https://github.com/Azure/azure-rest-api-specs/blob/2f28b5026a4b44adefd0237087acb0c48cfe31a6/specification/apimanagement/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/apimanagement/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true skip-csproj: true