diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/api/Azure.ResourceManager.HybridConnectivity.netstandard2.0.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/api/Azure.ResourceManager.HybridConnectivity.netstandard2.0.cs index 7fce9485b6ec..0acd6bb0cdd8 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/api/Azure.ResourceManager.HybridConnectivity.netstandard2.0.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/api/Azure.ResourceManager.HybridConnectivity.netstandard2.0.cs @@ -11,8 +11,15 @@ protected EndpointResource() { } public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetCredentials(long? expiresin = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetCredentialsAsync(long? expiresin = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetCredentials(Azure.ResourceManager.HybridConnectivity.Models.ListCredentialsContent content = null, long? expiresin = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCredentialsAsync(Azure.ResourceManager.HybridConnectivity.Models.ListCredentialsContent content = null, long? expiresin = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetIngressGatewayCredentials(Azure.ResourceManager.HybridConnectivity.Models.ListIngressGatewayCredentialsContent content = null, long? expiresin = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIngressGatewayCredentialsAsync(Azure.ResourceManager.HybridConnectivity.Models.ListIngressGatewayCredentialsContent content = null, long? expiresin = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetManagedProxyDetails(Azure.ResourceManager.HybridConnectivity.Models.ManagedProxyContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetManagedProxyDetailsAsync(Azure.ResourceManager.HybridConnectivity.Models.ManagedProxyContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetServiceConfigurationResource(string serviceConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetServiceConfigurationResourceAsync(string serviceConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridConnectivity.ServiceConfigurationResourceCollection GetServiceConfigurationResources() { throw null; } public virtual Azure.Response Update(Azure.ResourceManager.HybridConnectivity.EndpointResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridConnectivity.EndpointResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } @@ -34,15 +41,7 @@ protected EndpointResourceCollection() { } public partial class EndpointResourceData : Azure.ResourceManager.Models.ResourceData { public EndpointResourceData() { } - public string CreatedBy { get { throw null; } set { } } - public Azure.ResourceManager.HybridConnectivity.Models.CreatedByType? CreatedByType { get { throw null; } set { } } - public System.DateTimeOffset? CreatedOn { get { throw null; } set { } } - public Azure.ResourceManager.HybridConnectivity.Models.EndpointType? EndpointType { get { throw null; } set { } } - public string LastModifiedBy { get { throw null; } set { } } - public Azure.ResourceManager.HybridConnectivity.Models.CreatedByType? LastModifiedByType { get { throw null; } set { } } - public System.DateTimeOffset? LastModifiedOn { get { throw null; } set { } } - public string ProvisioningState { get { throw null; } } - public string ResourceId { get { throw null; } set { } } + public Azure.ResourceManager.HybridConnectivity.Models.EndpointProperties Properties { get { throw null; } set { } } } public static partial class HybridConnectivityExtensions { @@ -50,29 +49,54 @@ public static partial class HybridConnectivityExtensions public static Azure.Response GetEndpointResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string endpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> GetEndpointResourceAsync(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string endpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.HybridConnectivity.EndpointResourceCollection GetEndpointResources(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.ServiceConfigurationResource GetServiceConfigurationResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class ServiceConfigurationResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ServiceConfigurationResource() { } + public virtual Azure.ResourceManager.HybridConnectivity.ServiceConfigurationResourceData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string scope, string endpointName, string serviceConfigurationName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Update(Azure.ResourceManager.HybridConnectivity.Models.ServiceConfigurationResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridConnectivity.Models.ServiceConfigurationResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ServiceConfigurationResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ServiceConfigurationResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string serviceConfigurationName, Azure.ResourceManager.HybridConnectivity.ServiceConfigurationResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string serviceConfigurationName, Azure.ResourceManager.HybridConnectivity.ServiceConfigurationResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string serviceConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string serviceConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string serviceConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string serviceConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class ServiceConfigurationResourceData : Azure.ResourceManager.Models.ResourceData + { + public ServiceConfigurationResourceData() { } + public long? Port { get { throw null; } set { } } + public Azure.ResourceManager.HybridConnectivity.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string ResourceId { get { throw null; } set { } } + public Azure.ResourceManager.HybridConnectivity.Models.ServiceName? ServiceName { get { throw null; } set { } } } } namespace Azure.ResourceManager.HybridConnectivity.Models { - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct CreatedByType : System.IEquatable + public partial class EndpointProperties { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public CreatedByType(string value) { throw null; } - public static Azure.ResourceManager.HybridConnectivity.Models.CreatedByType Application { get { throw null; } } - public static Azure.ResourceManager.HybridConnectivity.Models.CreatedByType Key { get { throw null; } } - public static Azure.ResourceManager.HybridConnectivity.Models.CreatedByType ManagedIdentity { get { throw null; } } - public static Azure.ResourceManager.HybridConnectivity.Models.CreatedByType User { get { throw null; } } - public bool Equals(Azure.ResourceManager.HybridConnectivity.Models.CreatedByType other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.HybridConnectivity.Models.CreatedByType left, Azure.ResourceManager.HybridConnectivity.Models.CreatedByType right) { throw null; } - public static implicit operator Azure.ResourceManager.HybridConnectivity.Models.CreatedByType (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.HybridConnectivity.Models.CreatedByType left, Azure.ResourceManager.HybridConnectivity.Models.CreatedByType right) { throw null; } - public override string ToString() { throw null; } + public EndpointProperties(Azure.ResourceManager.HybridConnectivity.Models.EndpointType endpointType) { } + public Azure.ResourceManager.HybridConnectivity.Models.EndpointType EndpointType { get { throw null; } set { } } + public string ProvisioningState { get { throw null; } } + public string ResourceId { get { throw null; } set { } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct EndpointType : System.IEquatable @@ -92,6 +116,86 @@ namespace Azure.ResourceManager.HybridConnectivity.Models public static bool operator !=(Azure.ResourceManager.HybridConnectivity.Models.EndpointType left, Azure.ResourceManager.HybridConnectivity.Models.EndpointType right) { throw null; } public override string ToString() { throw null; } } + public partial class IngressGatewayResource + { + internal IngressGatewayResource() { } + public string AccessKey { get { throw null; } } + public long? ExpiresOn { get { throw null; } } + public string Hostname { get { throw null; } } + public string HybridConnectionName { get { throw null; } } + public string NamespaceName { get { throw null; } } + public string NamespaceNameSuffix { get { throw null; } } + public string ServerId { get { throw null; } } + public string ServiceConfigurationToken { get { throw null; } } + public System.Guid? TenantId { get { throw null; } } + } + public partial class ListCredentialsContent + { + public ListCredentialsContent() { } + public Azure.ResourceManager.HybridConnectivity.Models.ServiceName? ServiceName { get { throw null; } set { } } + } + public partial class ListIngressGatewayCredentialsContent + { + public ListIngressGatewayCredentialsContent() { } + public Azure.ResourceManager.HybridConnectivity.Models.ServiceName? ServiceName { get { throw null; } set { } } + } + public partial class ManagedProxyContent + { + public ManagedProxyContent(string service) { } + public string Hostname { get { throw null; } set { } } + public string Service { get { throw null; } } + public Azure.ResourceManager.HybridConnectivity.Models.ServiceName? ServiceName { get { throw null; } set { } } + } + public partial class ManagedProxyResource + { + internal ManagedProxyResource() { } + public long ExpiresOn { get { throw null; } } + public string Proxy { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.HybridConnectivity.Models.ProvisioningState Creating { get { throw null; } } + public static Azure.ResourceManager.HybridConnectivity.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.HybridConnectivity.Models.ProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.HybridConnectivity.Models.ProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridConnectivity.Models.ProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.HybridConnectivity.Models.ProvisioningState left, Azure.ResourceManager.HybridConnectivity.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridConnectivity.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridConnectivity.Models.ProvisioningState left, Azure.ResourceManager.HybridConnectivity.Models.ProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ServiceConfigurationResourcePatch + { + public ServiceConfigurationResourcePatch() { } + public long? Port { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ServiceName : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ServiceName(string value) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.Models.ServiceName SSH { get { throw null; } } + public static Azure.ResourceManager.HybridConnectivity.Models.ServiceName WAC { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridConnectivity.Models.ServiceName other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.HybridConnectivity.Models.ServiceName left, Azure.ResourceManager.HybridConnectivity.Models.ServiceName right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridConnectivity.Models.ServiceName (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridConnectivity.Models.ServiceName left, Azure.ResourceManager.HybridConnectivity.Models.ServiceName right) { throw null; } + public override string ToString() { throw null; } + } public partial class TargetResourceEndpointAccess { internal TargetResourceEndpointAccess() { } @@ -100,5 +204,6 @@ internal TargetResourceEndpointAccess() { } public string HybridConnectionName { get { throw null; } } public string NamespaceName { get { throw null; } } public string NamespaceNameSuffix { get { throw null; } } + public string ServiceConfigurationToken { get { throw null; } } } } diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResource.cs index bbedccc985ba..ecbecc0c8b00 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResource.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResource.cs @@ -87,6 +87,57 @@ 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 ServiceConfigurationResources in the EndpointResource. + /// An object representing collection of ServiceConfigurationResources and their operations over a ServiceConfigurationResource. + public virtual ServiceConfigurationResourceCollection GetServiceConfigurationResources() + { + return GetCachedClient(Client => new ServiceConfigurationResourceCollection(Client, Id)); + } + + /// + /// Gets the details about the service to the resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName} + /// + /// + /// Operation Id + /// ServiceConfigurations_Get + /// + /// + /// + /// The service name. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetServiceConfigurationResourceAsync(string serviceConfigurationName, CancellationToken cancellationToken = default) + { + return await GetServiceConfigurationResources().GetAsync(serviceConfigurationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details about the service to the resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName} + /// + /// + /// Operation Id + /// ServiceConfigurations_Get + /// + /// + /// + /// The service name. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public virtual Response GetServiceConfigurationResource(string serviceConfigurationName, CancellationToken cancellationToken = default) + { + return GetServiceConfigurationResources().Get(serviceConfigurationName, cancellationToken); + } + /// /// Gets the endpoint to the resource. /// @@ -300,15 +351,16 @@ public virtual Response Update(EndpointResourceData data, Canc /// /// /// + /// Object of type ListCredentialsRequest. /// The is how long the endpoint access token is valid (in seconds). /// The cancellation token to use. - public virtual async Task> GetCredentialsAsync(long? expiresin = null, CancellationToken cancellationToken = default) + public virtual async Task> GetCredentialsAsync(ListCredentialsContent content = null, long? expiresin = null, CancellationToken cancellationToken = default) { using var scope = _endpointResourceEndpointsClientDiagnostics.CreateScope("EndpointResource.GetCredentials"); scope.Start(); try { - var response = await _endpointResourceEndpointsRestClient.ListCredentialsAsync(Id.Parent, Id.Name, expiresin, cancellationToken).ConfigureAwait(false); + var response = await _endpointResourceEndpointsRestClient.ListCredentialsAsync(Id.Parent, Id.Name, content, expiresin, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -331,15 +383,148 @@ public virtual async Task> GetCredentials /// /// /// + /// Object of type ListCredentialsRequest. /// The is how long the endpoint access token is valid (in seconds). /// The cancellation token to use. - public virtual Response GetCredentials(long? expiresin = null, CancellationToken cancellationToken = default) + public virtual Response GetCredentials(ListCredentialsContent content = null, long? expiresin = null, CancellationToken cancellationToken = default) { using var scope = _endpointResourceEndpointsClientDiagnostics.CreateScope("EndpointResource.GetCredentials"); scope.Start(); try { - var response = _endpointResourceEndpointsRestClient.ListCredentials(Id.Parent, Id.Name, expiresin, cancellationToken); + var response = _endpointResourceEndpointsRestClient.ListCredentials(Id.Parent, Id.Name, content, expiresin, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the ingress gateway endpoint credentials + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listIngressGatewayCredentials + /// + /// + /// Operation Id + /// Endpoints_ListIngressGatewayCredentials + /// + /// + /// + /// Object of type ListIngressGatewayCredentialsRequest. + /// The is how long the endpoint access token is valid (in seconds). + /// The cancellation token to use. + public virtual async Task> GetIngressGatewayCredentialsAsync(ListIngressGatewayCredentialsContent content = null, long? expiresin = null, CancellationToken cancellationToken = default) + { + using var scope = _endpointResourceEndpointsClientDiagnostics.CreateScope("EndpointResource.GetIngressGatewayCredentials"); + scope.Start(); + try + { + var response = await _endpointResourceEndpointsRestClient.ListIngressGatewayCredentialsAsync(Id.Parent, Id.Name, content, expiresin, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the ingress gateway endpoint credentials + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listIngressGatewayCredentials + /// + /// + /// Operation Id + /// Endpoints_ListIngressGatewayCredentials + /// + /// + /// + /// Object of type ListIngressGatewayCredentialsRequest. + /// The is how long the endpoint access token is valid (in seconds). + /// The cancellation token to use. + public virtual Response GetIngressGatewayCredentials(ListIngressGatewayCredentialsContent content = null, long? expiresin = null, CancellationToken cancellationToken = default) + { + using var scope = _endpointResourceEndpointsClientDiagnostics.CreateScope("EndpointResource.GetIngressGatewayCredentials"); + scope.Start(); + try + { + var response = _endpointResourceEndpointsRestClient.ListIngressGatewayCredentials(Id.Parent, Id.Name, content, expiresin, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Fetches the managed proxy details + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listManagedProxyDetails + /// + /// + /// Operation Id + /// Endpoints_ListManagedProxyDetails + /// + /// + /// + /// Object of type ManagedProxyRequest. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetManagedProxyDetailsAsync(ManagedProxyContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _endpointResourceEndpointsClientDiagnostics.CreateScope("EndpointResource.GetManagedProxyDetails"); + scope.Start(); + try + { + var response = await _endpointResourceEndpointsRestClient.ListManagedProxyDetailsAsync(Id.Parent, Id.Name, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Fetches the managed proxy details + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listManagedProxyDetails + /// + /// + /// Operation Id + /// Endpoints_ListManagedProxyDetails + /// + /// + /// + /// Object of type ManagedProxyRequest. + /// The cancellation token to use. + /// is null. + public virtual Response GetManagedProxyDetails(ManagedProxyContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _endpointResourceEndpointsClientDiagnostics.CreateScope("EndpointResource.GetManagedProxyDetails"); + scope.Start(); + try + { + var response = _endpointResourceEndpointsRestClient.ListManagedProxyDetails(Id.Parent, Id.Name, content, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceData.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceData.cs index 4aa184f0b15d..160a381f5a51 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceData.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceData.cs @@ -5,7 +5,6 @@ #nullable disable -using System; using Azure.Core; using Azure.ResourceManager.HybridConnectivity.Models; using Azure.ResourceManager.Models; @@ -28,45 +27,13 @@ public EndpointResourceData() /// The name. /// The resourceType. /// The systemData. - /// The type of endpoint. - /// The resource Id of the connectivity endpoint (optional). - /// - /// The identity that created the resource. - /// The type of identity that created the resource. - /// The timestamp of resource creation (UTC). - /// The identity that last modified the resource. - /// The type of identity that last modified the resource. - /// The timestamp of resource last modification (UTC). - internal EndpointResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, EndpointType? endpointType, string resourceId, string provisioningState, string createdBy, Models.CreatedByType? createdByType, DateTimeOffset? createdOn, string lastModifiedBy, Models.CreatedByType? lastModifiedByType, DateTimeOffset? lastModifiedOn) : base(id, name, resourceType, systemData) + /// The endpoint properties. + internal EndpointResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, EndpointProperties properties) : base(id, name, resourceType, systemData) { - EndpointType = endpointType; - ResourceId = resourceId; - ProvisioningState = provisioningState; - CreatedBy = createdBy; - CreatedByType = createdByType; - CreatedOn = createdOn; - LastModifiedBy = lastModifiedBy; - LastModifiedByType = lastModifiedByType; - LastModifiedOn = lastModifiedOn; + Properties = properties; } - /// The type of endpoint. - public EndpointType? EndpointType { get; set; } - /// The resource Id of the connectivity endpoint (optional). - public string ResourceId { get; set; } - /// Gets the provisioning state. - public string ProvisioningState { get; } - /// The identity that created the resource. - public string CreatedBy { get; set; } - /// The type of identity that created the resource. - public Models.CreatedByType? CreatedByType { get; set; } - /// The timestamp of resource creation (UTC). - public DateTimeOffset? CreatedOn { get; set; } - /// The identity that last modified the resource. - public string LastModifiedBy { get; set; } - /// The type of identity that last modified the resource. - public Models.CreatedByType? LastModifiedByType { get; set; } - /// The timestamp of resource last modification (UTC). - public DateTimeOffset? LastModifiedOn { get; set; } + /// The endpoint properties. + public EndpointProperties Properties { get; set; } } } diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/HybridConnectivityExtensions.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/HybridConnectivityExtensions.cs index 130dd6baa23e..77e98a7e9ae4 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/HybridConnectivityExtensions.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/HybridConnectivityExtensions.cs @@ -51,6 +51,25 @@ public static EndpointResource GetEndpointResource(this ArmClient client, Resour } #endregion + #region ServiceConfigurationResource + /// + /// 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 ServiceConfigurationResource GetServiceConfigurationResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ServiceConfigurationResource.ValidateResourceId(id); + return new ServiceConfigurationResource(client, id); + } + ); + } + #endregion + /// Gets a collection of EndpointResources in the ArmResource. /// The instance the method will execute against. /// The scope that the resource will apply against. diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/CreatedByType.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/CreatedByType.cs deleted file mode 100644 index 93294150b61c..000000000000 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/CreatedByType.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.HybridConnectivity.Models -{ - /// The type of identity that created the resource. - public readonly partial struct CreatedByType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public CreatedByType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string UserValue = "User"; - private const string ApplicationValue = "Application"; - private const string ManagedIdentityValue = "ManagedIdentity"; - private const string KeyValue = "Key"; - - /// User. - public static CreatedByType User { get; } = new CreatedByType(UserValue); - /// Application. - public static CreatedByType Application { get; } = new CreatedByType(ApplicationValue); - /// ManagedIdentity. - public static CreatedByType ManagedIdentity { get; } = new CreatedByType(ManagedIdentityValue); - /// Key. - public static CreatedByType Key { get; } = new CreatedByType(KeyValue); - /// Determines if two values are the same. - public static bool operator ==(CreatedByType left, CreatedByType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(CreatedByType left, CreatedByType right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator CreatedByType(string value) => new CreatedByType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is CreatedByType other && Equals(other); - /// - public bool Equals(CreatedByType 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/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/EndpointProperties.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/EndpointProperties.Serialization.cs new file mode 100644 index 000000000000..d761ff63769e --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/EndpointProperties.Serialization.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class EndpointProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(EndpointType.ToString()); + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + writer.WriteEndObject(); + } + + internal static EndpointProperties DeserializeEndpointProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EndpointType type = default; + Optional resourceId = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new EndpointType(property.Value.GetString()); + continue; + } + if (property.NameEquals("resourceId"u8)) + { + resourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + provisioningState = property.Value.GetString(); + continue; + } + } + return new EndpointProperties(type, resourceId.Value, provisioningState.Value); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/EndpointProperties.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/EndpointProperties.cs new file mode 100644 index 000000000000..46117f196816 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/EndpointProperties.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Endpoint details. + public partial class EndpointProperties + { + /// Initializes a new instance of EndpointProperties. + /// The type of endpoint. + public EndpointProperties(EndpointType endpointType) + { + EndpointType = endpointType; + } + + /// Initializes a new instance of EndpointProperties. + /// The type of endpoint. + /// The resource Id of the connectivity endpoint (optional). + /// The resource provisioning state. + internal EndpointProperties(EndpointType endpointType, string resourceId, string provisioningState) + { + EndpointType = endpointType; + ResourceId = resourceId; + ProvisioningState = provisioningState; + } + + /// The type of endpoint. + public EndpointType EndpointType { get; set; } + /// The resource Id of the connectivity endpoint (optional). + public string ResourceId { get; set; } + /// The resource provisioning state. + public string ProvisioningState { get; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/EndpointResourceData.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/EndpointResourceData.Serialization.cs index 84b11cd81920..68ab5f6d32ef 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/EndpointResourceData.Serialization.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/EndpointResourceData.Serialization.cs @@ -5,7 +5,6 @@ #nullable disable -using System; using System.Text.Json; using Azure.Core; using Azure.ResourceManager.HybridConnectivity.Models; @@ -18,53 +17,12 @@ public partial class EndpointResourceData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(EndpointType)) - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(EndpointType.Value.ToString()); - } - if (Optional.IsDefined(ResourceId)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("resourceId"u8); - writer.WriteStringValue(ResourceId); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); } writer.WriteEndObject(); - writer.WritePropertyName("systemData"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(CreatedBy)) - { - writer.WritePropertyName("createdBy"u8); - writer.WriteStringValue(CreatedBy); - } - if (Optional.IsDefined(CreatedByType)) - { - writer.WritePropertyName("createdByType"u8); - writer.WriteStringValue(CreatedByType.Value.ToString()); - } - if (Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("createdAt"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); - } - if (Optional.IsDefined(LastModifiedBy)) - { - writer.WritePropertyName("lastModifiedBy"u8); - writer.WriteStringValue(LastModifiedBy); - } - if (Optional.IsDefined(LastModifiedByType)) - { - writer.WritePropertyName("lastModifiedByType"u8); - writer.WriteStringValue(LastModifiedByType.Value.ToString()); - } - if (Optional.IsDefined(LastModifiedOn)) - { - writer.WritePropertyName("lastModifiedAt"u8); - writer.WriteStringValue(LastModifiedOn.Value, "O"); - } - writer.WriteEndObject(); - writer.WriteEndObject(); } internal static EndpointResourceData DeserializeEndpointResourceData(JsonElement element) @@ -73,21 +31,22 @@ internal static EndpointResourceData DeserializeEndpointResourceData(JsonElement { return null; } + Optional properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; Optional systemData = default; - Optional type0 = default; - Optional resourceId = default; - Optional provisioningState = default; - Optional createdBy = default; - Optional createdByType = default; - Optional createdAt = default; - Optional lastModifiedBy = default; - Optional lastModifiedByType = default; - Optional lastModifiedAt = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = EndpointProperties.DeserializeEndpointProperties(property.Value); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -112,97 +71,8 @@ internal static EndpointResourceData DeserializeEndpointResourceData(JsonElement 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("type"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - type0 = new EndpointType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("resourceId"u8)) - { - resourceId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - } - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("createdBy"u8)) - { - createdBy = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("createdByType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdByType = new Models.CreatedByType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("createdAt"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdAt = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("lastModifiedBy"u8)) - { - lastModifiedBy = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("lastModifiedByType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - lastModifiedByType = new Models.CreatedByType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("lastModifiedAt"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - lastModifiedAt = property0.Value.GetDateTimeOffset("O"); - continue; - } - } - continue; - } } - return new EndpointResourceData(id, name, type, systemData.Value, Optional.ToNullable(type0), resourceId.Value, provisioningState.Value, createdBy.Value, Optional.ToNullable(createdByType), Optional.ToNullable(createdAt), lastModifiedBy.Value, Optional.ToNullable(lastModifiedByType), Optional.ToNullable(lastModifiedAt)); + return new EndpointResourceData(id, name, type, systemData.Value, properties.Value); } } } diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/IngressGatewayResource.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/IngressGatewayResource.Serialization.cs new file mode 100644 index 000000000000..678ca1f2d949 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/IngressGatewayResource.Serialization.cs @@ -0,0 +1,126 @@ +// 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.HybridConnectivity.Models +{ + public partial class IngressGatewayResource + { + internal static IngressGatewayResource DeserializeIngressGatewayResource(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional hostname = default; + Optional serverId = default; + Optional tenantId = default; + Optional namespaceName = default; + Optional namespaceNameSuffix = default; + Optional hybridConnectionName = default; + Optional accessKey = default; + Optional expiresOn = default; + Optional serviceConfigurationToken = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ingress"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("hostname"u8)) + { + hostname = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("aadProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property1 in property0.Value.EnumerateObject()) + { + if (property1.NameEquals("serverId"u8)) + { + serverId = property1.Value.GetString(); + continue; + } + if (property1.NameEquals("tenantId"u8)) + { + if (property1.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tenantId = property1.Value.GetGuid(); + continue; + } + } + continue; + } + } + continue; + } + if (property.NameEquals("relay"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("namespaceName"u8)) + { + namespaceName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("namespaceNameSuffix"u8)) + { + namespaceNameSuffix = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("hybridConnectionName"u8)) + { + hybridConnectionName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("accessKey"u8)) + { + accessKey = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("expiresOn"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expiresOn = property0.Value.GetInt64(); + continue; + } + if (property0.NameEquals("serviceConfigurationToken"u8)) + { + serviceConfigurationToken = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new IngressGatewayResource(hostname.Value, serverId.Value, Optional.ToNullable(tenantId), namespaceName.Value, namespaceNameSuffix.Value, hybridConnectionName.Value, accessKey.Value, Optional.ToNullable(expiresOn), serviceConfigurationToken.Value); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/IngressGatewayResource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/IngressGatewayResource.cs new file mode 100644 index 000000000000..05e0ba72c07e --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/IngressGatewayResource.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// The ingress gateway access credentials. + public partial class IngressGatewayResource + { + /// Initializes a new instance of IngressGatewayResource. + internal IngressGatewayResource() + { + } + + /// Initializes a new instance of IngressGatewayResource. + /// The ingress hostname. + /// The arc ingress gateway server app id. + /// The target resource home tenant id. + /// The namespace name. + /// The suffix domain name of relay namespace. + /// Azure Relay hybrid connection name for the resource. + /// Access key for hybrid connection. + /// The expiration of access key in unix time. + /// The token to access the enabled service. + internal IngressGatewayResource(string hostname, string serverId, Guid? tenantId, string namespaceName, string namespaceNameSuffix, string hybridConnectionName, string accessKey, long? expiresOn, string serviceConfigurationToken) + { + Hostname = hostname; + ServerId = serverId; + TenantId = tenantId; + NamespaceName = namespaceName; + NamespaceNameSuffix = namespaceNameSuffix; + HybridConnectionName = hybridConnectionName; + AccessKey = accessKey; + ExpiresOn = expiresOn; + ServiceConfigurationToken = serviceConfigurationToken; + } + + /// The ingress hostname. + public string Hostname { get; } + /// The arc ingress gateway server app id. + public string ServerId { get; } + /// The target resource home tenant id. + public Guid? TenantId { get; } + /// The namespace name. + public string NamespaceName { get; } + /// The suffix domain name of relay namespace. + public string NamespaceNameSuffix { get; } + /// Azure Relay hybrid connection name for the resource. + public string HybridConnectionName { get; } + /// Access key for hybrid connection. + public string AccessKey { get; } + /// The expiration of access key in unix time. + public long? ExpiresOn { get; } + /// The token to access the enabled service. + public string ServiceConfigurationToken { get; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ListCredentialsContent.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ListCredentialsContent.Serialization.cs new file mode 100644 index 000000000000..2dc4ada4715f --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ListCredentialsContent.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.HybridConnectivity.Models +{ + public partial class ListCredentialsContent : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ServiceName)) + { + writer.WritePropertyName("serviceName"u8); + writer.WriteStringValue(ServiceName.Value.ToString()); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ListCredentialsContent.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ListCredentialsContent.cs new file mode 100644 index 000000000000..ae6290b68d11 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ListCredentialsContent.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// The details of the service for which credentials needs to be returned. + public partial class ListCredentialsContent + { + /// Initializes a new instance of ListCredentialsContent. + public ListCredentialsContent() + { + } + + /// The name of the service. If not provided, the request will by pass the generation of service configuration token. + public ServiceName? ServiceName { get; set; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ListIngressGatewayCredentialsContent.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ListIngressGatewayCredentialsContent.Serialization.cs new file mode 100644 index 000000000000..40b73cac454e --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ListIngressGatewayCredentialsContent.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.HybridConnectivity.Models +{ + public partial class ListIngressGatewayCredentialsContent : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ServiceName)) + { + writer.WritePropertyName("serviceName"u8); + writer.WriteStringValue(ServiceName.Value.ToString()); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ListIngressGatewayCredentialsContent.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ListIngressGatewayCredentialsContent.cs new file mode 100644 index 000000000000..113147adcb65 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ListIngressGatewayCredentialsContent.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Represent ListIngressGatewayCredentials Request object. + public partial class ListIngressGatewayCredentialsContent + { + /// Initializes a new instance of ListIngressGatewayCredentialsContent. + public ListIngressGatewayCredentialsContent() + { + } + + /// The name of the service. + public ServiceName? ServiceName { get; set; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyContent.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyContent.Serialization.cs new file mode 100644 index 000000000000..1cfdbc885182 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyContent.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.HybridConnectivity.Models +{ + public partial class ManagedProxyContent : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("service"u8); + writer.WriteStringValue(Service); + if (Optional.IsDefined(Hostname)) + { + writer.WritePropertyName("hostname"u8); + writer.WriteStringValue(Hostname); + } + if (Optional.IsDefined(ServiceName)) + { + writer.WritePropertyName("serviceName"u8); + writer.WriteStringValue(ServiceName.Value.ToString()); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyContent.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyContent.cs new file mode 100644 index 000000000000..fde90d00902a --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyContent.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Represent ManageProxy Request object. + public partial class ManagedProxyContent + { + /// Initializes a new instance of ManagedProxyContent. + /// The name of the service. + /// is null. + public ManagedProxyContent(string service) + { + Argument.AssertNotNull(service, nameof(service)); + + Service = service; + } + + /// The name of the service. + public string Service { get; } + /// The target host name. + public string Hostname { get; set; } + /// The name of the service. It is an optional property, if not provided, service configuration tokens issue code would be by passed. + public ServiceName? ServiceName { get; set; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyResource.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyResource.Serialization.cs new file mode 100644 index 000000000000..bdaaaa89f415 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyResource.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.HybridConnectivity.Models +{ + public partial class ManagedProxyResource + { + internal static ManagedProxyResource DeserializeManagedProxyResource(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string proxy = default; + long expiresOn = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("proxy"u8)) + { + proxy = property.Value.GetString(); + continue; + } + if (property.NameEquals("expiresOn"u8)) + { + expiresOn = property.Value.GetInt64(); + continue; + } + } + return new ManagedProxyResource(proxy, expiresOn); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyResource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyResource.cs new file mode 100644 index 000000000000..6f5fdc410f5a --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyResource.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Managed Proxy. + public partial class ManagedProxyResource + { + /// Initializes a new instance of ManagedProxyResource. + /// The short lived proxy name. + /// The expiration time of short lived proxy name in unix epoch. + /// is null. + internal ManagedProxyResource(string proxy, long expiresOn) + { + Argument.AssertNotNull(proxy, nameof(proxy)); + + Proxy = proxy; + ExpiresOn = expiresOn; + } + + /// The short lived proxy name. + public string Proxy { get; } + /// The expiration time of short lived proxy name in unix epoch. + public long ExpiresOn { get; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ProvisioningState.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..a543592175a0 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// The resource provisioning state. + public readonly partial struct ProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string CreatingValue = "Creating"; + private const string UpdatingValue = "Updating"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Succeeded. + public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + /// Creating. + public static ProvisioningState Creating { get; } = new ProvisioningState(CreatingValue); + /// Updating. + public static ProvisioningState Updating { get; } = new ProvisioningState(UpdatingValue); + /// Failed. + public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + /// Canceled. + public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ProvisioningState(string value) => new ProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvisioningState other && Equals(other); + /// + public bool Equals(ProvisioningState 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/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationList.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationList.Serialization.cs new file mode 100644 index 000000000000..5cea16404a0f --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationList.Serialization.cs @@ -0,0 +1,50 @@ +// 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.HybridConnectivity; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + internal partial class ServiceConfigurationList + { + internal static ServiceConfigurationList DeserializeServiceConfigurationList(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) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ServiceConfigurationResourceData.DeserializeServiceConfigurationResourceData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ServiceConfigurationList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationList.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationList.cs new file mode 100644 index 000000000000..b5fe4bdc0298 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationList.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.HybridConnectivity; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// The paginated list of serviceConfigurations. + internal partial class ServiceConfigurationList + { + /// Initializes a new instance of ServiceConfigurationList. + internal ServiceConfigurationList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ServiceConfigurationList. + /// The list of service configuration. + /// The link to fetch the next page of connected cluster. + internal ServiceConfigurationList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The list of service configuration. + public IReadOnlyList Value { get; } + /// The link to fetch the next page of connected cluster. + public string NextLink { get; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationResourceData.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationResourceData.Serialization.cs new file mode 100644 index 000000000000..efb9c37ef818 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationResourceData.Serialization.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridConnectivity.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridConnectivity +{ + public partial class ServiceConfigurationResourceData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ServiceName)) + { + writer.WritePropertyName("serviceName"u8); + writer.WriteStringValue(ServiceName.Value.ToString()); + } + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (Optional.IsDefined(Port)) + { + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ServiceConfigurationResourceData DeserializeServiceConfigurationResourceData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional serviceName = default; + Optional resourceId = default; + Optional port = default; + Optional provisioningState = 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) + { + 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("serviceName"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceName = new ServiceName(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("resourceId"u8)) + { + resourceId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("port"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + port = property0.Value.GetInt64(); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new ServiceConfigurationResourceData(id, name, type, systemData.Value, Optional.ToNullable(serviceName), resourceId.Value, Optional.ToNullable(port), Optional.ToNullable(provisioningState)); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationResourcePatch.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationResourcePatch.Serialization.cs new file mode 100644 index 000000000000..031a7f0094e1 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationResourcePatch.Serialization.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class ServiceConfigurationResourcePatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Port)) + { + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationResourcePatch.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationResourcePatch.cs new file mode 100644 index 000000000000..1edf2c0ca99d --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationResourcePatch.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// The service details under service configuration for the target endpoint resource. + public partial class ServiceConfigurationResourcePatch + { + /// Initializes a new instance of ServiceConfigurationResourcePatch. + public ServiceConfigurationResourcePatch() + { + } + + /// The port on which service is enabled. + public long? Port { get; set; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceName.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceName.cs new file mode 100644 index 000000000000..e4547882a22b --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceName.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.HybridConnectivity.Models +{ + /// Name of the service. + public readonly partial struct ServiceName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ServiceName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SSHValue = "SSH"; + private const string WACValue = "WAC"; + + /// SSH. + public static ServiceName SSH { get; } = new ServiceName(SSHValue); + /// WAC. + public static ServiceName WAC { get; } = new ServiceName(WACValue); + /// Determines if two values are the same. + public static bool operator ==(ServiceName left, ServiceName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ServiceName left, ServiceName right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ServiceName(string value) => new ServiceName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ServiceName other && Equals(other); + /// + public bool Equals(ServiceName 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/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/TargetResourceEndpointAccess.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/TargetResourceEndpointAccess.Serialization.cs index d4f7fc404c3e..8f5b05c78ca7 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/TargetResourceEndpointAccess.Serialization.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/TargetResourceEndpointAccess.Serialization.cs @@ -23,6 +23,7 @@ internal static TargetResourceEndpointAccess DeserializeTargetResourceEndpointAc Optional hybridConnectionName = default; Optional accessKey = default; Optional expiresOn = default; + Optional serviceConfigurationToken = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("relay"u8)) @@ -63,11 +64,16 @@ internal static TargetResourceEndpointAccess DeserializeTargetResourceEndpointAc expiresOn = property0.Value.GetInt64(); continue; } + if (property0.NameEquals("serviceConfigurationToken"u8)) + { + serviceConfigurationToken = property0.Value.GetString(); + continue; + } } continue; } } - return new TargetResourceEndpointAccess(namespaceName.Value, namespaceNameSuffix.Value, hybridConnectionName.Value, accessKey.Value, Optional.ToNullable(expiresOn)); + return new TargetResourceEndpointAccess(namespaceName.Value, namespaceNameSuffix.Value, hybridConnectionName.Value, accessKey.Value, Optional.ToNullable(expiresOn), serviceConfigurationToken.Value); } } } diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/TargetResourceEndpointAccess.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/TargetResourceEndpointAccess.cs index aea434dac1b2..9a7608d7cb0b 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/TargetResourceEndpointAccess.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/TargetResourceEndpointAccess.cs @@ -21,13 +21,15 @@ internal TargetResourceEndpointAccess() /// Azure Relay hybrid connection name for the resource. /// Access key for hybrid connection. /// The expiration of access key in unix time. - internal TargetResourceEndpointAccess(string namespaceName, string namespaceNameSuffix, string hybridConnectionName, string accessKey, long? expiresOn) + /// The token to access the enabled service. + internal TargetResourceEndpointAccess(string namespaceName, string namespaceNameSuffix, string hybridConnectionName, string accessKey, long? expiresOn, string serviceConfigurationToken) { NamespaceName = namespaceName; NamespaceNameSuffix = namespaceNameSuffix; HybridConnectionName = hybridConnectionName; AccessKey = accessKey; ExpiresOn = expiresOn; + ServiceConfigurationToken = serviceConfigurationToken; } /// The namespace name. @@ -40,5 +42,7 @@ internal TargetResourceEndpointAccess(string namespaceName, string namespaceName public string AccessKey { get; } /// The expiration of access key in unix time. public long? ExpiresOn { get; } + /// The token to access the enabled service. + public string ServiceConfigurationToken { get; } } } diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/EndpointsRestOperations.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/EndpointsRestOperations.cs index 9a9a031d05ac..5165f56f3930 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/EndpointsRestOperations.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/EndpointsRestOperations.cs @@ -33,7 +33,7 @@ public EndpointsRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-10-06-preview"; + _apiVersion = apiVersion ?? "2023-03-15"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -394,7 +394,7 @@ public Response Delete(string scope, string endpointName, CancellationToken canc } } - internal HttpMessage CreateListCredentialsRequest(string scope, string endpointName, long? expiresin) + internal HttpMessage CreateListCredentialsRequest(string scope, string endpointName, ListCredentialsContent content, long? expiresin) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -413,6 +413,13 @@ internal HttpMessage CreateListCredentialsRequest(string scope, string endpointN } request.Uri = uri; request.Headers.Add("Accept", "application/json"); + if (content != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content); + request.Content = content0; + } _userAgent.Apply(message); return message; } @@ -420,15 +427,16 @@ internal HttpMessage CreateListCredentialsRequest(string scope, string endpointN /// Gets the endpoint access credentials to the resource. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The endpoint name. + /// Object of type ListCredentialsRequest. /// The is how long the endpoint access token is valid (in seconds). /// The cancellation token to use. /// or is null. - public async Task> ListCredentialsAsync(string scope, string endpointName, long? expiresin = null, CancellationToken cancellationToken = default) + public async Task> ListCredentialsAsync(string scope, string endpointName, ListCredentialsContent content = null, long? expiresin = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNull(endpointName, nameof(endpointName)); - using var message = CreateListCredentialsRequest(scope, endpointName, expiresin); + using var message = CreateListCredentialsRequest(scope, endpointName, content, expiresin); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -447,15 +455,16 @@ public async Task> ListCredentialsAsync(s /// Gets the endpoint access credentials to the resource. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The endpoint name. + /// Object of type ListCredentialsRequest. /// The is how long the endpoint access token is valid (in seconds). /// The cancellation token to use. /// or is null. - public Response ListCredentials(string scope, string endpointName, long? expiresin = null, CancellationToken cancellationToken = default) + public Response ListCredentials(string scope, string endpointName, ListCredentialsContent content = null, long? expiresin = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNull(endpointName, nameof(endpointName)); - using var message = CreateListCredentialsRequest(scope, endpointName, expiresin); + using var message = CreateListCredentialsRequest(scope, endpointName, content, expiresin); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -471,6 +480,171 @@ public Response ListCredentials(string scope, stri } } + internal HttpMessage CreateListIngressGatewayCredentialsRequest(string scope, string endpointName, ListIngressGatewayCredentialsContent content, long? expiresin) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/endpoints/", false); + uri.AppendPath(endpointName, false); + uri.AppendPath("/listIngressGatewayCredentials", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (expiresin != null) + { + uri.AppendQuery("expiresin", expiresin.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (content != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content); + request.Content = content0; + } + _userAgent.Apply(message); + return message; + } + + /// Gets the ingress gateway endpoint credentials. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The endpoint name. + /// Object of type ListIngressGatewayCredentialsRequest. + /// The is how long the endpoint access token is valid (in seconds). + /// The cancellation token to use. + /// or is null. + public async Task> ListIngressGatewayCredentialsAsync(string scope, string endpointName, ListIngressGatewayCredentialsContent content = null, long? expiresin = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(endpointName, nameof(endpointName)); + + using var message = CreateListIngressGatewayCredentialsRequest(scope, endpointName, content, expiresin); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + IngressGatewayResource value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = IngressGatewayResource.DeserializeIngressGatewayResource(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the ingress gateway endpoint credentials. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The endpoint name. + /// Object of type ListIngressGatewayCredentialsRequest. + /// The is how long the endpoint access token is valid (in seconds). + /// The cancellation token to use. + /// or is null. + public Response ListIngressGatewayCredentials(string scope, string endpointName, ListIngressGatewayCredentialsContent content = null, long? expiresin = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(endpointName, nameof(endpointName)); + + using var message = CreateListIngressGatewayCredentialsRequest(scope, endpointName, content, expiresin); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + IngressGatewayResource value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = IngressGatewayResource.DeserializeIngressGatewayResource(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListManagedProxyDetailsRequest(string scope, string endpointName, ManagedProxyContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/endpoints/", false); + uri.AppendPath(endpointName, false); + uri.AppendPath("/listManagedProxyDetails", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + 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; + } + + /// Fetches the managed proxy details. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The endpoint name. + /// Object of type ManagedProxyRequest. + /// The cancellation token to use. + /// , or is null. + public async Task> ListManagedProxyDetailsAsync(string scope, string endpointName, ManagedProxyContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(endpointName, nameof(endpointName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateListManagedProxyDetailsRequest(scope, endpointName, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedProxyResource value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedProxyResource.DeserializeManagedProxyResource(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Fetches the managed proxy details. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The endpoint name. + /// Object of type ManagedProxyRequest. + /// The cancellation token to use. + /// , or is null. + public Response ListManagedProxyDetails(string scope, string endpointName, ManagedProxyContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(endpointName, nameof(endpointName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateListManagedProxyDetailsRequest(scope, endpointName, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedProxyResource value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedProxyResource.DeserializeManagedProxyResource(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateListNextPageRequest(string nextLink, string scope) { var message = _pipeline.CreateMessage(); diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/ServiceConfigurationsRestOperations.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/ServiceConfigurationsRestOperations.cs new file mode 100644 index 000000000000..fe67adc29148 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/ServiceConfigurationsRestOperations.cs @@ -0,0 +1,499 @@ +// 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.HybridConnectivity.Models; + +namespace Azure.ResourceManager.HybridConnectivity +{ + internal partial class ServiceConfigurationsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ServiceConfigurationsRestOperations. + /// 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 ServiceConfigurationsRestOperations(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 ?? "2023-03-15"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByEndpointResourceRequest(string scope, string endpointName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/endpoints/", false); + uri.AppendPath(endpointName, false); + uri.AppendPath("/serviceConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// API to enumerate registered services in service configurations under a Endpoint Resource. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The endpoint name. + /// The cancellation token to use. + /// or is null. + public async Task> ListByEndpointResourceAsync(string scope, string endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(endpointName, nameof(endpointName)); + + using var message = CreateListByEndpointResourceRequest(scope, endpointName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ServiceConfigurationList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServiceConfigurationList.DeserializeServiceConfigurationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// API to enumerate registered services in service configurations under a Endpoint Resource. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The endpoint name. + /// The cancellation token to use. + /// or is null. + public Response ListByEndpointResource(string scope, string endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(endpointName, nameof(endpointName)); + + using var message = CreateListByEndpointResourceRequest(scope, endpointName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ServiceConfigurationList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServiceConfigurationList.DeserializeServiceConfigurationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string scope, string endpointName, string serviceConfigurationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/endpoints/", false); + uri.AppendPath(endpointName, false); + uri.AppendPath("/serviceConfigurations/", false); + uri.AppendPath(serviceConfigurationName, false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details about the service to the resource. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The endpoint name. + /// The service name. + /// The cancellation token to use. + /// , or is null. + public async Task> GetAsync(string scope, string endpointName, string serviceConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(endpointName, nameof(endpointName)); + Argument.AssertNotNull(serviceConfigurationName, nameof(serviceConfigurationName)); + + using var message = CreateGetRequest(scope, endpointName, serviceConfigurationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ServiceConfigurationResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServiceConfigurationResourceData.DeserializeServiceConfigurationResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ServiceConfigurationResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details about the service to the resource. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The endpoint name. + /// The service name. + /// The cancellation token to use. + /// , or is null. + public Response Get(string scope, string endpointName, string serviceConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(endpointName, nameof(endpointName)); + Argument.AssertNotNull(serviceConfigurationName, nameof(serviceConfigurationName)); + + using var message = CreateGetRequest(scope, endpointName, serviceConfigurationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ServiceConfigurationResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServiceConfigurationResourceData.DeserializeServiceConfigurationResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ServiceConfigurationResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrupdateRequest(string scope, string endpointName, string serviceConfigurationName, ServiceConfigurationResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/endpoints/", false); + uri.AppendPath(endpointName, false); + uri.AppendPath("/serviceConfigurations/", false); + uri.AppendPath(serviceConfigurationName, 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(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or update a service in serviceConfiguration for the endpoint resource. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The endpoint name. + /// The service name. + /// Service details. + /// The cancellation token to use. + /// , , or is null. + public async Task> CreateOrupdateAsync(string scope, string endpointName, string serviceConfigurationName, ServiceConfigurationResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(endpointName, nameof(endpointName)); + Argument.AssertNotNull(serviceConfigurationName, nameof(serviceConfigurationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrupdateRequest(scope, endpointName, serviceConfigurationName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ServiceConfigurationResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServiceConfigurationResourceData.DeserializeServiceConfigurationResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or update a service in serviceConfiguration for the endpoint resource. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The endpoint name. + /// The service name. + /// Service details. + /// The cancellation token to use. + /// , , or is null. + public Response CreateOrupdate(string scope, string endpointName, string serviceConfigurationName, ServiceConfigurationResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(endpointName, nameof(endpointName)); + Argument.AssertNotNull(serviceConfigurationName, nameof(serviceConfigurationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrupdateRequest(scope, endpointName, serviceConfigurationName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ServiceConfigurationResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServiceConfigurationResourceData.DeserializeServiceConfigurationResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string scope, string endpointName, string serviceConfigurationName, ServiceConfigurationResourcePatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/endpoints/", false); + uri.AppendPath(endpointName, false); + uri.AppendPath("/serviceConfigurations/", false); + uri.AppendPath(serviceConfigurationName, 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(patch); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update the service details in the service configurations of the target resource. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The endpoint name. + /// The service name. + /// Service details. + /// The cancellation token to use. + /// , , or is null. + public async Task> UpdateAsync(string scope, string endpointName, string serviceConfigurationName, ServiceConfigurationResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(endpointName, nameof(endpointName)); + Argument.AssertNotNull(serviceConfigurationName, nameof(serviceConfigurationName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(scope, endpointName, serviceConfigurationName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ServiceConfigurationResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServiceConfigurationResourceData.DeserializeServiceConfigurationResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update the service details in the service configurations of the target resource. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The endpoint name. + /// The service name. + /// Service details. + /// The cancellation token to use. + /// , , or is null. + public Response Update(string scope, string endpointName, string serviceConfigurationName, ServiceConfigurationResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(endpointName, nameof(endpointName)); + Argument.AssertNotNull(serviceConfigurationName, nameof(serviceConfigurationName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(scope, endpointName, serviceConfigurationName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ServiceConfigurationResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServiceConfigurationResourceData.DeserializeServiceConfigurationResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string scope, string endpointName, string serviceConfigurationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/endpoints/", false); + uri.AppendPath(endpointName, false); + uri.AppendPath("/serviceConfigurations/", false); + uri.AppendPath(serviceConfigurationName, false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the service details to the target resource. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The endpoint name. + /// The service name. + /// The cancellation token to use. + /// , or is null. + public async Task DeleteAsync(string scope, string endpointName, string serviceConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(endpointName, nameof(endpointName)); + Argument.AssertNotNull(serviceConfigurationName, nameof(serviceConfigurationName)); + + using var message = CreateDeleteRequest(scope, endpointName, serviceConfigurationName); + 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 service details to the target resource. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The endpoint name. + /// The service name. + /// The cancellation token to use. + /// , or is null. + public Response Delete(string scope, string endpointName, string serviceConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(endpointName, nameof(endpointName)); + Argument.AssertNotNull(serviceConfigurationName, nameof(serviceConfigurationName)); + + using var message = CreateDeleteRequest(scope, endpointName, serviceConfigurationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByEndpointResourceNextPageRequest(string nextLink, string scope, string endpointName) + { + 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; + } + + /// API to enumerate registered services in service configurations under a Endpoint Resource. + /// The URL to the next page of results. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The endpoint name. + /// The cancellation token to use. + /// , or is null. + public async Task> ListByEndpointResourceNextPageAsync(string nextLink, string scope, string endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(endpointName, nameof(endpointName)); + + using var message = CreateListByEndpointResourceNextPageRequest(nextLink, scope, endpointName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ServiceConfigurationList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServiceConfigurationList.DeserializeServiceConfigurationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// API to enumerate registered services in service configurations under a Endpoint Resource. + /// The URL to the next page of results. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The endpoint name. + /// The cancellation token to use. + /// , or is null. + public Response ListByEndpointResourceNextPage(string nextLink, string scope, string endpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(endpointName, nameof(endpointName)); + + using var message = CreateListByEndpointResourceNextPageRequest(nextLink, scope, endpointName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ServiceConfigurationList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServiceConfigurationList.DeserializeServiceConfigurationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ServiceConfigurationResource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ServiceConfigurationResource.cs new file mode 100644 index 000000000000..4273e017a2e5 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ServiceConfigurationResource.cs @@ -0,0 +1,290 @@ +// 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.HybridConnectivity.Models; + +namespace Azure.ResourceManager.HybridConnectivity +{ + /// + /// A Class representing a ServiceConfigurationResource 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 GetServiceConfigurationResource method. + /// Otherwise you can get one from its parent resource using the GetServiceConfigurationResource method. + /// + public partial class ServiceConfigurationResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string scope, string endpointName, string serviceConfigurationName) + { + var resourceId = $"{scope}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _serviceConfigurationResourceServiceConfigurationsClientDiagnostics; + private readonly ServiceConfigurationsRestOperations _serviceConfigurationResourceServiceConfigurationsRestClient; + private readonly ServiceConfigurationResourceData _data; + + /// Initializes a new instance of the class for mocking. + protected ServiceConfigurationResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ServiceConfigurationResource(ArmClient client, ServiceConfigurationResourceData 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 ServiceConfigurationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceConfigurationResourceServiceConfigurationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridConnectivity", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string serviceConfigurationResourceServiceConfigurationsApiVersion); + _serviceConfigurationResourceServiceConfigurationsRestClient = new ServiceConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceConfigurationResourceServiceConfigurationsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridConnectivity/endpoints/serviceConfigurations"; + + /// 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 ServiceConfigurationResourceData 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 about the service to the resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName} + /// + /// + /// Operation Id + /// ServiceConfigurations_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _serviceConfigurationResourceServiceConfigurationsClientDiagnostics.CreateScope("ServiceConfigurationResource.Get"); + scope.Start(); + try + { + var response = await _serviceConfigurationResourceServiceConfigurationsRestClient.GetAsync(Id.Parent.Parent, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details about the service to the resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName} + /// + /// + /// Operation Id + /// ServiceConfigurations_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _serviceConfigurationResourceServiceConfigurationsClientDiagnostics.CreateScope("ServiceConfigurationResource.Get"); + scope.Start(); + try + { + var response = _serviceConfigurationResourceServiceConfigurationsRestClient.Get(Id.Parent.Parent, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the service details to the target resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName} + /// + /// + /// Operation Id + /// ServiceConfigurations_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 = _serviceConfigurationResourceServiceConfigurationsClientDiagnostics.CreateScope("ServiceConfigurationResource.Delete"); + scope.Start(); + try + { + var response = await _serviceConfigurationResourceServiceConfigurationsRestClient.DeleteAsync(Id.Parent.Parent, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridConnectivityArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the service details to the target resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName} + /// + /// + /// Operation Id + /// ServiceConfigurations_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 = _serviceConfigurationResourceServiceConfigurationsClientDiagnostics.CreateScope("ServiceConfigurationResource.Delete"); + scope.Start(); + try + { + var response = _serviceConfigurationResourceServiceConfigurationsRestClient.Delete(Id.Parent.Parent, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new HybridConnectivityArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the service details in the service configurations of the target resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName} + /// + /// + /// Operation Id + /// ServiceConfigurations_Update + /// + /// + /// + /// Service details. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ServiceConfigurationResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _serviceConfigurationResourceServiceConfigurationsClientDiagnostics.CreateScope("ServiceConfigurationResource.Update"); + scope.Start(); + try + { + var response = await _serviceConfigurationResourceServiceConfigurationsRestClient.UpdateAsync(Id.Parent.Parent, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ServiceConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the service details in the service configurations of the target resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName} + /// + /// + /// Operation Id + /// ServiceConfigurations_Update + /// + /// + /// + /// Service details. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ServiceConfigurationResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _serviceConfigurationResourceServiceConfigurationsClientDiagnostics.CreateScope("ServiceConfigurationResource.Update"); + scope.Start(); + try + { + var response = _serviceConfigurationResourceServiceConfigurationsRestClient.Update(Id.Parent.Parent, Id.Parent.Name, Id.Name, patch, cancellationToken); + return Response.FromValue(new ServiceConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ServiceConfigurationResourceCollection.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ServiceConfigurationResourceCollection.cs new file mode 100644 index 000000000000..0ca513a026af --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ServiceConfigurationResourceCollection.cs @@ -0,0 +1,334 @@ +// 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.HybridConnectivity +{ + /// + /// 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 GetServiceConfigurationResources method from an instance of . + /// + public partial class ServiceConfigurationResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _serviceConfigurationResourceServiceConfigurationsClientDiagnostics; + private readonly ServiceConfigurationsRestOperations _serviceConfigurationResourceServiceConfigurationsRestClient; + + /// Initializes a new instance of the class for mocking. + protected ServiceConfigurationResourceCollection() + { + } + + /// 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 ServiceConfigurationResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _serviceConfigurationResourceServiceConfigurationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridConnectivity", ServiceConfigurationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ServiceConfigurationResource.ResourceType, out string serviceConfigurationResourceServiceConfigurationsApiVersion); + _serviceConfigurationResourceServiceConfigurationsRestClient = new ServiceConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, serviceConfigurationResourceServiceConfigurationsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != EndpointResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, EndpointResource.ResourceType), nameof(id)); + } + + /// + /// Create or update a service in serviceConfiguration for the endpoint resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName} + /// + /// + /// Operation Id + /// ServiceConfigurations_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 service name. + /// Service details. + /// The cancellation token to use. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string serviceConfigurationName, ServiceConfigurationResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(serviceConfigurationName, nameof(serviceConfigurationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceConfigurationResourceServiceConfigurationsClientDiagnostics.CreateScope("ServiceConfigurationResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _serviceConfigurationResourceServiceConfigurationsRestClient.CreateOrupdateAsync(Id.Parent, Id.Name, serviceConfigurationName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridConnectivityArmOperation(Response.FromValue(new ServiceConfigurationResource(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 a service in serviceConfiguration for the endpoint resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName} + /// + /// + /// Operation Id + /// ServiceConfigurations_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 service name. + /// Service details. + /// The cancellation token to use. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string serviceConfigurationName, ServiceConfigurationResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(serviceConfigurationName, nameof(serviceConfigurationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _serviceConfigurationResourceServiceConfigurationsClientDiagnostics.CreateScope("ServiceConfigurationResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _serviceConfigurationResourceServiceConfigurationsRestClient.CreateOrupdate(Id.Parent, Id.Name, serviceConfigurationName, data, cancellationToken); + var operation = new HybridConnectivityArmOperation(Response.FromValue(new ServiceConfigurationResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details about the service to the resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName} + /// + /// + /// Operation Id + /// ServiceConfigurations_Get + /// + /// + /// + /// The service name. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetAsync(string serviceConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(serviceConfigurationName, nameof(serviceConfigurationName)); + + using var scope = _serviceConfigurationResourceServiceConfigurationsClientDiagnostics.CreateScope("ServiceConfigurationResourceCollection.Get"); + scope.Start(); + try + { + var response = await _serviceConfigurationResourceServiceConfigurationsRestClient.GetAsync(Id.Parent, Id.Name, serviceConfigurationName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details about the service to the resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName} + /// + /// + /// Operation Id + /// ServiceConfigurations_Get + /// + /// + /// + /// The service name. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string serviceConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(serviceConfigurationName, nameof(serviceConfigurationName)); + + using var scope = _serviceConfigurationResourceServiceConfigurationsClientDiagnostics.CreateScope("ServiceConfigurationResourceCollection.Get"); + scope.Start(); + try + { + var response = _serviceConfigurationResourceServiceConfigurationsRestClient.Get(Id.Parent, Id.Name, serviceConfigurationName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ServiceConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// API to enumerate registered services in service configurations under a Endpoint Resource + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations + /// + /// + /// Operation Id + /// ServiceConfigurations_ListByEndpointResource + /// + /// + /// + /// 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) => _serviceConfigurationResourceServiceConfigurationsRestClient.CreateListByEndpointResourceRequest(Id.Parent, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceConfigurationResourceServiceConfigurationsRestClient.CreateListByEndpointResourceNextPageRequest(nextLink, Id.Parent, Id.Name); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceConfigurationResource(Client, ServiceConfigurationResourceData.DeserializeServiceConfigurationResourceData(e)), _serviceConfigurationResourceServiceConfigurationsClientDiagnostics, Pipeline, "ServiceConfigurationResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// API to enumerate registered services in service configurations under a Endpoint Resource + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations + /// + /// + /// Operation Id + /// ServiceConfigurations_ListByEndpointResource + /// + /// + /// + /// 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) => _serviceConfigurationResourceServiceConfigurationsRestClient.CreateListByEndpointResourceRequest(Id.Parent, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _serviceConfigurationResourceServiceConfigurationsRestClient.CreateListByEndpointResourceNextPageRequest(nextLink, Id.Parent, Id.Name); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceConfigurationResource(Client, ServiceConfigurationResourceData.DeserializeServiceConfigurationResourceData(e)), _serviceConfigurationResourceServiceConfigurationsClientDiagnostics, Pipeline, "ServiceConfigurationResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName} + /// + /// + /// Operation Id + /// ServiceConfigurations_Get + /// + /// + /// + /// The service name. + /// The cancellation token to use. + /// is null. + public virtual async Task> ExistsAsync(string serviceConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(serviceConfigurationName, nameof(serviceConfigurationName)); + + using var scope = _serviceConfigurationResourceServiceConfigurationsClientDiagnostics.CreateScope("ServiceConfigurationResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _serviceConfigurationResourceServiceConfigurationsRestClient.GetAsync(Id.Parent, Id.Name, serviceConfigurationName, 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 + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName} + /// + /// + /// Operation Id + /// ServiceConfigurations_Get + /// + /// + /// + /// The service name. + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string serviceConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(serviceConfigurationName, nameof(serviceConfigurationName)); + + using var scope = _serviceConfigurationResourceServiceConfigurationsClientDiagnostics.CreateScope("ServiceConfigurationResourceCollection.Exists"); + scope.Start(); + try + { + var response = _serviceConfigurationResourceServiceConfigurationsRestClient.Get(Id.Parent, Id.Name, serviceConfigurationName, 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/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ServiceConfigurationResourceData.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ServiceConfigurationResourceData.cs new file mode 100644 index 000000000000..601a7eeb1a86 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ServiceConfigurationResourceData.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.HybridConnectivity.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridConnectivity +{ + /// + /// A class representing the ServiceConfigurationResource data model. + /// The service configuration details associated with the target resource. + /// + public partial class ServiceConfigurationResourceData : ResourceData + { + /// Initializes a new instance of ServiceConfigurationResourceData. + public ServiceConfigurationResourceData() + { + } + + /// Initializes a new instance of ServiceConfigurationResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Name of the service. + /// The resource Id of the connectivity endpoint (optional). + /// The port on which service is enabled. + /// The resource provisioning state. + internal ServiceConfigurationResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ServiceName? serviceName, string resourceId, long? port, ProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + { + ServiceName = serviceName; + ResourceId = resourceId; + Port = port; + ProvisioningState = provisioningState; + } + + /// Name of the service. + public ServiceName? ServiceName { get; set; } + /// The resource Id of the connectivity endpoint (optional). + public string ResourceId { get; set; } + /// The port on which service is enabled. + public long? Port { get; set; } + /// The resource provisioning state. + public ProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/autorest.md b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/autorest.md index e3a90757a9bf..9e26ead939f7 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/autorest.md +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/autorest.md @@ -10,7 +10,7 @@ csharp: true library-name: HybridConnectivity namespace: Azure.ResourceManager.HybridConnectivity # default tag is a preview version -require: https://github.com/Azure/azure-rest-api-specs/blob/3c162c839b8fe17544d9a3be8383a835dd42eb28/specification/hybridconnectivity/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/hybridconnectivity/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true skip-csproj: true