From ee810fed2bc8a6376e5bce28bf5b17636651ea08 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 22 Dec 2022 02:44:07 +0000 Subject: [PATCH] CodeGen from PR 21974 in Azure/azure-rest-api-specs Merge 740468a6d49391e6b1e14ad997a75fc68b5e8e63 into f9e272186af02eb26b2563e438e8b120c772a5cc --- ...nager.HybridConnectivity.netstandard2.0.cs | 14 ++++ .../src/Generated/EndpointResource.cs | 52 ++++++++++++ .../src/Generated/EndpointResourceData.cs | 4 +- .../ManagedProxyContent.Serialization.cs | 28 +++++++ .../Generated/Models/ManagedProxyContent.cs | 31 +++++++ .../ManagedProxyResource.Serialization.cs | 35 ++++++++ .../Generated/Models/ManagedProxyResource.cs | 33 ++++++++ .../RestOperations/EndpointsRestOperations.cs | 81 ++++++++++++++++++- .../src/autorest.md | 2 +- 9 files changed, 276 insertions(+), 4 deletions(-) create mode 100644 sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyContent.Serialization.cs create mode 100644 sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyContent.cs create mode 100644 sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyResource.Serialization.cs create mode 100644 sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyResource.cs 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..a549b42d0c7c 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 @@ -13,6 +13,8 @@ protected EndpointResource() { } 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 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 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; } } @@ -92,6 +94,18 @@ 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 ManagedProxyContent + { + public ManagedProxyContent(string service) { } + public string Hostname { get { throw null; } set { } } + public string Service { get { throw null; } } + } + public partial class ManagedProxyResource + { + internal ManagedProxyResource() { } + public long ExpiresOn { get { throw null; } } + public string Proxy { get { throw null; } } + } public partial class TargetResourceEndpointAccess { internal TargetResourceEndpointAccess() { } diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResource.cs index 3c1bacbfb741..e600b823598c 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResource.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResource.cs @@ -284,5 +284,57 @@ public virtual Response GetCredentials(long? expir 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) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceData.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceData.cs index 41919f037bd1..424125d6fab6 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceData.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceData.cs @@ -27,7 +27,7 @@ public EndpointResourceData() /// The systemData. /// The type of endpoint. /// The resource Id of the connectivity endpoint (optional). - /// + /// The resource provisioning state. /// The identity that created the resource. /// The type of identity that created the resource. /// The timestamp of resource creation (UTC). @@ -51,7 +51,7 @@ internal EndpointResourceData(ResourceIdentifier id, string name, ResourceType r public EndpointType? EndpointType { get; set; } /// The resource Id of the connectivity endpoint (optional). public string ResourceId { get; set; } - /// Gets the provisioning state. + /// The resource provisioning state. public string ProvisioningState { get; } /// The identity that created the resource. public string CreatedBy { 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..174227c10859 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyContent.Serialization.cs @@ -0,0 +1,28 @@ +// 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"); + writer.WriteStringValue(Service); + if (Optional.IsDefined(Hostname)) + { + writer.WritePropertyName("hostname"); + writer.WriteStringValue(Hostname); + } + 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..68edaf6d34b9 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyContent.cs @@ -0,0 +1,31 @@ +// 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; } + } +} 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..1e0f1b3b9f23 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyResource.Serialization.cs @@ -0,0 +1,35 @@ +// 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) + { + string proxy = default; + long expiresOn = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("proxy")) + { + proxy = property.Value.GetString(); + continue; + } + if (property.NameEquals("expiresOn")) + { + 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/RestOperations/EndpointsRestOperations.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/EndpointsRestOperations.cs index 9a9a031d05ac..7e563fde0401 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 ?? "2022-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -471,6 +471,85 @@ public Response ListCredentials(string scope, stri } } + 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/autorest.md b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/autorest.md index a55732c723ea..d72415f8b57f 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/autorest.md +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/autorest.md @@ -9,7 +9,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