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 6cf1e17715b8..d859c739f432 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; } Azure.ResourceManager.HybridConnectivity.EndpointResourceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.HybridConnectivity.EndpointResourceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -41,15 +48,7 @@ protected EndpointResourceCollection() { } public partial class EndpointResourceData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { 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 { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.HybridConnectivity.EndpointResourceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -63,6 +62,265 @@ 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.InventoryResource GetInventoryResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetPublicCloudConnector(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string publicCloudConnector, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetPublicCloudConnectorAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string publicCloudConnector, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.PublicCloudConnectorResource GetPublicCloudConnectorResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.PublicCloudConnectorCollection GetPublicCloudConnectors(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetPublicCloudConnectors(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetPublicCloudConnectorsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.ServiceConfigurationResource GetServiceConfigurationResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetSolutionConfiguration(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string solutionConfiguration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetSolutionConfigurationAsync(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string solutionConfiguration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.SolutionConfigurationResource GetSolutionConfigurationResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.SolutionConfigurationCollection GetSolutionConfigurations(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.SolutionTypeResource GetSolutionTypeResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetSolutionTypeResource(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string solutionType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetSolutionTypeResourceAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string solutionType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.SolutionTypeResourceCollection GetSolutionTypeResources(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetSolutionTypeResources(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetSolutionTypeResourcesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response PostGenerateAwsTemplate(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.HybridConnectivity.Models.GenerateAwsTemplateContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> PostGenerateAwsTemplateAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.HybridConnectivity.Models.GenerateAwsTemplateContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class InventoryResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected InventoryResource() { } + public virtual Azure.ResourceManager.HybridConnectivity.InventoryResourceData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string resourceUri, string solutionConfiguration, string inventoryId) { 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; } + Azure.ResourceManager.HybridConnectivity.InventoryResourceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.InventoryResourceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class InventoryResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected InventoryResourceCollection() { } + public virtual Azure.Response Exists(string inventoryId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string inventoryId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string inventoryId, 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 inventoryId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string inventoryId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string inventoryId, 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 InventoryResourceData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InventoryResourceData() { } + public Azure.ResourceManager.HybridConnectivity.Models.InventoryProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.InventoryResourceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.InventoryResourceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class PublicCloudConnectorCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected PublicCloudConnectorCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string publicCloudConnector, Azure.ResourceManager.HybridConnectivity.PublicCloudConnectorData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string publicCloudConnector, Azure.ResourceManager.HybridConnectivity.PublicCloudConnectorData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string publicCloudConnector, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string publicCloudConnector, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string publicCloudConnector, 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 publicCloudConnector, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string publicCloudConnector, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string publicCloudConnector, 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 PublicCloudConnectorData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public PublicCloudConnectorData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.HybridConnectivity.Models.PublicCloudConnectorProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.PublicCloudConnectorData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.PublicCloudConnectorData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class PublicCloudConnectorResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected PublicCloudConnectorResource() { } + public virtual Azure.ResourceManager.HybridConnectivity.PublicCloudConnectorData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publicCloudConnector) { 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 RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.HybridConnectivity.PublicCloudConnectorData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.PublicCloudConnectorData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation TestPermissions(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> TestPermissionsAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Update(Azure.ResourceManager.HybridConnectivity.Models.PublicCloudConnectorPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridConnectivity.Models.PublicCloudConnectorPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ServiceConfigurationResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + 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; } + Azure.ResourceManager.HybridConnectivity.ServiceConfigurationResourceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.ServiceConfigurationResourceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { 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; } + public virtual Azure.NullableResponse GetIfExists(string serviceConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(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, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + 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 { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.ServiceConfigurationResourceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.ServiceConfigurationResourceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SolutionConfigurationCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SolutionConfigurationCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string solutionConfiguration, Azure.ResourceManager.HybridConnectivity.SolutionConfigurationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string solutionConfiguration, Azure.ResourceManager.HybridConnectivity.SolutionConfigurationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string solutionConfiguration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string solutionConfiguration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string solutionConfiguration, 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 solutionConfiguration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string solutionConfiguration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string solutionConfiguration, 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 SolutionConfigurationData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SolutionConfigurationData() { } + public Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.SolutionConfigurationData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.SolutionConfigurationData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SolutionConfigurationResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SolutionConfigurationResource() { } + public virtual Azure.ResourceManager.HybridConnectivity.SolutionConfigurationData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string resourceUri, string solutionConfiguration) { 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 GetInventoryResource(string inventoryId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetInventoryResourceAsync(string inventoryId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridConnectivity.InventoryResourceCollection GetInventoryResources() { throw null; } + public virtual Azure.ResourceManager.ArmOperation SyncNow(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SyncNowAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.HybridConnectivity.SolutionConfigurationData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.SolutionConfigurationData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.Response Update(Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class SolutionTypeResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SolutionTypeResource() { } + public virtual Azure.ResourceManager.HybridConnectivity.SolutionTypeResourceData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string solutionType) { 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; } + Azure.ResourceManager.HybridConnectivity.SolutionTypeResourceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.SolutionTypeResourceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SolutionTypeResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SolutionTypeResourceCollection() { } + public virtual Azure.Response Exists(string solutionType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string solutionType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string solutionType, 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 solutionType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string solutionType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string solutionType, 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 SolutionTypeResourceData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SolutionTypeResourceData() { } + public Azure.ResourceManager.HybridConnectivity.Models.SolutionTypeProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.SolutionTypeResourceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.SolutionTypeResourceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } } namespace Azure.ResourceManager.HybridConnectivity.Mocking @@ -74,35 +332,103 @@ protected MockableHybridConnectivityArmClient() { } public virtual Azure.Response GetEndpointResource(Azure.Core.ResourceIdentifier scope, string endpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetEndpointResourceAsync(Azure.Core.ResourceIdentifier scope, string endpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.HybridConnectivity.EndpointResourceCollection GetEndpointResources(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.HybridConnectivity.InventoryResource GetInventoryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridConnectivity.PublicCloudConnectorResource GetPublicCloudConnectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridConnectivity.ServiceConfigurationResource GetServiceConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetSolutionConfiguration(Azure.Core.ResourceIdentifier scope, string solutionConfiguration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSolutionConfigurationAsync(Azure.Core.ResourceIdentifier scope, string solutionConfiguration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridConnectivity.SolutionConfigurationResource GetSolutionConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridConnectivity.SolutionConfigurationCollection GetSolutionConfigurations(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.HybridConnectivity.SolutionTypeResource GetSolutionTypeResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableHybridConnectivityResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableHybridConnectivityResourceGroupResource() { } + public virtual Azure.Response GetPublicCloudConnector(string publicCloudConnector, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPublicCloudConnectorAsync(string publicCloudConnector, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridConnectivity.PublicCloudConnectorCollection GetPublicCloudConnectors() { throw null; } + public virtual Azure.Response GetSolutionTypeResource(string solutionType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSolutionTypeResourceAsync(string solutionType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridConnectivity.SolutionTypeResourceCollection GetSolutionTypeResources() { throw null; } + } + public partial class MockableHybridConnectivitySubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableHybridConnectivitySubscriptionResource() { } + public virtual Azure.Pageable GetPublicCloudConnectors(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPublicCloudConnectorsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSolutionTypeResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSolutionTypeResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response PostGenerateAwsTemplate(Azure.ResourceManager.HybridConnectivity.Models.GenerateAwsTemplateContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> PostGenerateAwsTemplateAsync(Azure.ResourceManager.HybridConnectivity.Models.GenerateAwsTemplateContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.HybridConnectivity.Models { public static partial class ArmHybridConnectivityModelFactory { - public static Azure.ResourceManager.HybridConnectivity.EndpointResourceData EndpointResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.HybridConnectivity.Models.EndpointType? endpointType = default(Azure.ResourceManager.HybridConnectivity.Models.EndpointType?), string resourceId = null, string provisioningState = null, string createdBy = null, Azure.ResourceManager.HybridConnectivity.Models.CreatedByType? createdByType = default(Azure.ResourceManager.HybridConnectivity.Models.CreatedByType?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string lastModifiedBy = null, Azure.ResourceManager.HybridConnectivity.Models.CreatedByType? lastModifiedByType = default(Azure.ResourceManager.HybridConnectivity.Models.CreatedByType?), System.DateTimeOffset? lastModifiedOn = default(System.DateTimeOffset?)) { throw null; } - public static Azure.ResourceManager.HybridConnectivity.Models.TargetResourceEndpointAccess TargetResourceEndpointAccess(string namespaceName = null, string namespaceNameSuffix = null, string hybridConnectionName = null, string accessKey = null, long? expiresOn = default(long?)) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.Models.EndpointProperties EndpointProperties(Azure.ResourceManager.HybridConnectivity.Models.EndpointType endpointType = default(Azure.ResourceManager.HybridConnectivity.Models.EndpointType), string resourceId = null, string provisioningState = null) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.EndpointResourceData EndpointResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.HybridConnectivity.Models.EndpointProperties properties = null) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.Models.GenerateAwsTemplateContent GenerateAwsTemplateContent(string connectorId = null, System.Collections.Generic.IEnumerable solutionTypes = null) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.Models.IngressGatewayResource IngressGatewayResource(string hostname = null, string serverId = null, System.Guid? tenantId = default(System.Guid?), string namespaceName = null, string namespaceNameSuffix = null, string hybridConnectionName = null, string accessKey = null, long? expiresOn = default(long?), string serviceConfigurationToken = null) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.Models.InventoryProperties InventoryProperties(Azure.ResourceManager.HybridConnectivity.Models.CloudNativeType? cloudNativeType = default(Azure.ResourceManager.HybridConnectivity.Models.CloudNativeType?), string cloudNativeResourceId = null, string azureResourceId = null, Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationStatus? status = default(Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationStatus?), string statusDetails = null, Azure.ResourceManager.HybridConnectivity.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.HybridConnectivity.Models.ResourceProvisioningState?)) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.InventoryResourceData InventoryResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.HybridConnectivity.Models.InventoryProperties properties = null) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.Models.ManagedProxyContent ManagedProxyContent(string service = null, string hostname = null, Azure.ResourceManager.HybridConnectivity.Models.ServiceName? serviceName = default(Azure.ResourceManager.HybridConnectivity.Models.ServiceName?)) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.Models.ManagedProxyResource ManagedProxyResource(string proxy = null, long expiresOn = (long)0) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.Models.OperationStatusResult OperationStatusResult(Azure.Core.ResourceIdentifier id = null, Azure.Core.ResourceIdentifier resourceId = null, string name = null, string status = null, float? percentComplete = default(float?), System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable operations = null, Azure.ResponseError error = null) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.PublicCloudConnectorData PublicCloudConnectorData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.HybridConnectivity.Models.PublicCloudConnectorProperties properties = null) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.Models.PublicCloudConnectorPatch PublicCloudConnectorPatch(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IEnumerable awsCloudExcludedAccounts = null, System.Collections.Generic.IDictionary tags = null) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.Models.PublicCloudConnectorProperties PublicCloudConnectorProperties(Azure.ResourceManager.HybridConnectivity.Models.AwsCloudProfile awsCloudProfile = null, Azure.ResourceManager.HybridConnectivity.Models.HostType hostType = default(Azure.ResourceManager.HybridConnectivity.Models.HostType), Azure.ResourceManager.HybridConnectivity.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.HybridConnectivity.Models.ResourceProvisioningState?), string connectorPrimaryIdentifier = null) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.ServiceConfigurationResourceData ServiceConfigurationResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.HybridConnectivity.Models.ServiceName? serviceName = default(Azure.ResourceManager.HybridConnectivity.Models.ServiceName?), string resourceId = null, long? port = default(long?), Azure.ResourceManager.HybridConnectivity.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridConnectivity.Models.ProvisioningState?)) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.SolutionConfigurationData SolutionConfigurationData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationProperties properties = null) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationPatch SolutionConfigurationPatch(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationPropertiesUpdate properties = null) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationProperties SolutionConfigurationProperties(Azure.ResourceManager.HybridConnectivity.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.HybridConnectivity.Models.ResourceProvisioningState?), string solutionType = null, System.Collections.Generic.IDictionary solutionSettings = null, Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationStatus? status = default(Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationStatus?), string statusDetails = null, System.DateTimeOffset? lastSyncOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.SolutionTypeResourceData SolutionTypeResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.HybridConnectivity.Models.SolutionTypeProperties properties = null) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.Models.SolutionTypeSettings SolutionTypeSettings(string solutionType = null, System.Collections.Generic.IDictionary solutionSettings = null) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.Models.TargetResourceEndpointAccess TargetResourceEndpointAccess(string namespaceName = null, string namespaceNameSuffix = null, string hybridConnectionName = null, string accessKey = null, long? expiresOn = default(long?), string serviceConfigurationToken = null) { throw null; } + } + public partial class AwsCloudProfile : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AwsCloudProfile(string accountId) { } + public string AccountId { get { throw null; } set { } } + public System.Collections.Generic.IList ExcludedAccounts { get { throw null; } } + public bool? IsOrganizationalAccount { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.AwsCloudProfile System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.AwsCloudProfile System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct CreatedByType : System.IEquatable + public readonly partial struct CloudNativeType : System.IEquatable { 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; } + public CloudNativeType(string value) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.Models.CloudNativeType Ec2 { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridConnectivity.Models.CloudNativeType 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 static bool operator ==(Azure.ResourceManager.HybridConnectivity.Models.CloudNativeType left, Azure.ResourceManager.HybridConnectivity.Models.CloudNativeType right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridConnectivity.Models.CloudNativeType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridConnectivity.Models.CloudNativeType left, Azure.ResourceManager.HybridConnectivity.Models.CloudNativeType right) { throw null; } public override string ToString() { throw null; } } + public partial class EndpointProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + 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 { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.EndpointProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.EndpointProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct EndpointType : System.IEquatable { @@ -121,6 +447,332 @@ public static partial class ArmHybridConnectivityModelFactory 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 GenerateAwsTemplateContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GenerateAwsTemplateContent(string connectorId) { } + public string ConnectorId { get { throw null; } } + public System.Collections.Generic.IList SolutionTypes { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.GenerateAwsTemplateContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.GenerateAwsTemplateContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HostType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public HostType(string value) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.Models.HostType AWS { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridConnectivity.Models.HostType 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.HostType left, Azure.ResourceManager.HybridConnectivity.Models.HostType right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridConnectivity.Models.HostType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridConnectivity.Models.HostType left, Azure.ResourceManager.HybridConnectivity.Models.HostType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class IngressGatewayResource : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + 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; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.IngressGatewayResource System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.IngressGatewayResource System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class InventoryProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InventoryProperties() { } + public string AzureResourceId { get { throw null; } set { } } + public string CloudNativeResourceId { get { throw null; } set { } } + public Azure.ResourceManager.HybridConnectivity.Models.CloudNativeType? CloudNativeType { get { throw null; } set { } } + public Azure.ResourceManager.HybridConnectivity.Models.ResourceProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationStatus? Status { get { throw null; } set { } } + public string StatusDetails { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.InventoryProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.InventoryProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ListCredentialsContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ListCredentialsContent() { } + public Azure.ResourceManager.HybridConnectivity.Models.ServiceName? ServiceName { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.ListCredentialsContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.ListCredentialsContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ListIngressGatewayCredentialsContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ListIngressGatewayCredentialsContent() { } + public Azure.ResourceManager.HybridConnectivity.Models.ServiceName? ServiceName { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.ListIngressGatewayCredentialsContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.ListIngressGatewayCredentialsContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ManagedProxyContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + 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 { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.ManagedProxyContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.ManagedProxyContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ManagedProxyResource : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ManagedProxyResource() { } + public long ExpiresOn { get { throw null; } } + public string Proxy { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.ManagedProxyResource System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.ManagedProxyResource System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class OperationStatusResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal OperationStatusResult() { } + public System.DateTimeOffset? EndOn { get { throw null; } } + public Azure.ResponseError Error { get { throw null; } } + public Azure.Core.ResourceIdentifier Id { get { throw null; } } + public string Name { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Operations { get { throw null; } } + public float? PercentComplete { get { throw null; } } + public Azure.Core.ResourceIdentifier ResourceId { get { throw null; } } + public System.DateTimeOffset? StartOn { get { throw null; } } + public string Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.OperationStatusResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.OperationStatusResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { 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 PublicCloudConnectorPatch : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public PublicCloudConnectorPatch() { } + public System.Collections.Generic.IList AwsCloudExcludedAccounts { get { throw null; } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.PublicCloudConnectorPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.PublicCloudConnectorPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class PublicCloudConnectorProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public PublicCloudConnectorProperties(Azure.ResourceManager.HybridConnectivity.Models.AwsCloudProfile awsCloudProfile, Azure.ResourceManager.HybridConnectivity.Models.HostType hostType) { } + public Azure.ResourceManager.HybridConnectivity.Models.AwsCloudProfile AwsCloudProfile { get { throw null; } set { } } + public string ConnectorPrimaryIdentifier { get { throw null; } } + public Azure.ResourceManager.HybridConnectivity.Models.HostType HostType { get { throw null; } set { } } + public Azure.ResourceManager.HybridConnectivity.Models.ResourceProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.PublicCloudConnectorProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.PublicCloudConnectorProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ResourceProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ResourceProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.Models.ResourceProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.HybridConnectivity.Models.ResourceProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.HybridConnectivity.Models.ResourceProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridConnectivity.Models.ResourceProvisioningState 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.ResourceProvisioningState left, Azure.ResourceManager.HybridConnectivity.Models.ResourceProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridConnectivity.Models.ResourceProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridConnectivity.Models.ResourceProvisioningState left, Azure.ResourceManager.HybridConnectivity.Models.ResourceProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ServiceConfigurationResourcePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ServiceConfigurationResourcePatch() { } + public long? Port { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.ServiceConfigurationResourcePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.ServiceConfigurationResourcePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [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 SolutionConfigurationPatch : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SolutionConfigurationPatch() { } + public Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationPropertiesUpdate Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SolutionConfigurationProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SolutionConfigurationProperties(string solutionType) { } + public System.DateTimeOffset? LastSyncOn { get { throw null; } } + public Azure.ResourceManager.HybridConnectivity.Models.ResourceProvisioningState? ProvisioningState { get { throw null; } } + public System.Collections.Generic.IDictionary SolutionSettings { get { throw null; } } + public string SolutionType { get { throw null; } set { } } + public Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationStatus? Status { get { throw null; } } + public string StatusDetails { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SolutionConfigurationPropertiesUpdate : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SolutionConfigurationPropertiesUpdate() { } + public System.Collections.Generic.IDictionary SolutionSettings { get { throw null; } } + public string SolutionType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationPropertiesUpdate System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationPropertiesUpdate System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SolutionConfigurationStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SolutionConfigurationStatus(string value) { throw null; } + public static Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationStatus Completed { get { throw null; } } + public static Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationStatus Failed { get { throw null; } } + public static Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationStatus InProgress { get { throw null; } } + public static Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationStatus New { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationStatus 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.SolutionConfigurationStatus left, Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationStatus left, Azure.ResourceManager.HybridConnectivity.Models.SolutionConfigurationStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SolutionTypeProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SolutionTypeProperties() { } + public string Description { get { throw null; } set { } } + public System.Collections.Generic.IList SolutionSettings { get { throw null; } } + public string SolutionType { get { throw null; } set { } } + public System.Collections.Generic.IList SupportedAzureRegions { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.SolutionTypeProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.SolutionTypeProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SolutionTypeSettings : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SolutionTypeSettings(string solutionType) { } + public System.Collections.Generic.IDictionary SolutionSettings { get { throw null; } } + public string SolutionType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.SolutionTypeSettings System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.SolutionTypeSettings System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SolutionTypeSettingsProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SolutionTypeSettingsProperties(string name, string displayName, string solutionTypeSettingsPropertiesType, string description, System.Collections.Generic.IEnumerable allowedValues, string defaultValue) { } + public System.Collections.Generic.IList AllowedValues { get { throw null; } } + public string DefaultValue { get { throw null; } set { } } + public string Description { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public string SolutionTypeSettingsPropertiesType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.SolutionTypeSettingsProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.HybridConnectivity.Models.SolutionTypeSettingsProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class TargetResourceEndpointAccess : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal TargetResourceEndpointAccess() { } @@ -129,6 +781,7 @@ 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; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.HybridConnectivity.Models.TargetResourceEndpointAccess System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_EndpointResource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_EndpointResource.cs index 5c118520db2b..7e522c3e7226 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_EndpointResource.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_EndpointResource.cs @@ -20,7 +20,7 @@ public partial class Sample_EndpointResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_HybridConnectivityEndpointsGetCustom() { - // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsGetCustom.json + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsGetCustom.json // this example is just showing the usage of "Endpoints_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_HybridConnectivityEndpointsGetCustom() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_HybridConnectivityEndpointsGetDefault() { - // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsGetDefault.json + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsGetDefault.json // this example is just showing the usage of "Endpoints_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -80,7 +80,7 @@ public async Task Get_HybridConnectivityEndpointsGetDefault() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_HybridConnectivityEndpointsPatchDefault() { - // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsPatchDefault.json + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsPatchDefault.json // this example is just showing the usage of "Endpoints_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -98,7 +98,7 @@ public async Task Update_HybridConnectivityEndpointsPatchDefault() // invoke the operation EndpointResourceData data = new EndpointResourceData() { - EndpointType = EndpointType.Default, + Properties = new EndpointProperties(EndpointType.Default), }; EndpointResource result = await endpointResource.UpdateAsync(data); @@ -114,7 +114,7 @@ public async Task Update_HybridConnectivityEndpointsPatchDefault() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_HybridConnectivityEndpointsDeleteDefault() { - // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsDeleteDefault.json + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsDeleteDefault.json // this example is just showing the usage of "Endpoints_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -140,7 +140,7 @@ public async Task Delete_HybridConnectivityEndpointsDeleteDefault() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetCredentials_HybridConnectivityEndpointsPostListCredentials() { - // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsPostListCredentials.json + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsPostListCredentials.json // this example is just showing the usage of "Endpoints_ListCredentials" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -155,9 +155,71 @@ public async Task GetCredentials_HybridConnectivityEndpointsPostListCredentials( ResourceIdentifier endpointResourceId = EndpointResource.CreateResourceIdentifier(scope, endpointName); EndpointResource endpointResource = client.GetEndpointResource(endpointResourceId); + // invoke the operation + ListCredentialsContent content = new ListCredentialsContent() + { + ServiceName = ServiceName.SSH, + }; + long? expiresin = 10800; + TargetResourceEndpointAccess result = await endpointResource.GetCredentialsAsync(content: content, expiresin: expiresin); + + Console.WriteLine($"Succeeded: {result}"); + } + + // HybridConnectivityEndpointsPostListIngressGatewayCredentials + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIngressGatewayCredentials_HybridConnectivityEndpointsPostListIngressGatewayCredentials() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsPostListIngressGatewayCredentials.json + // this example is just showing the usage of "Endpoints_ListIngressGatewayCredentials" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this EndpointResource created on azure + // for more information of creating EndpointResource, please refer to the document of EndpointResource + string scope = "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/arcGroup/providers/Microsoft.ArcPlaceHolder/ProvisionedClusters/cluster0"; + string endpointName = "default"; + ResourceIdentifier endpointResourceId = EndpointResource.CreateResourceIdentifier(scope, endpointName); + EndpointResource endpointResource = client.GetEndpointResource(endpointResourceId); + // invoke the operation long? expiresin = 10800; - TargetResourceEndpointAccess result = await endpointResource.GetCredentialsAsync(expiresin: expiresin); + IngressGatewayResource result = await endpointResource.GetIngressGatewayCredentialsAsync(expiresin: expiresin); + + Console.WriteLine($"Succeeded: {result}"); + } + + // HybridConnectivityEndpointsPostListManagedProxyDetails + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetManagedProxyDetails_HybridConnectivityEndpointsPostListManagedProxyDetails() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsPostListManagedProxyDetails.json + // this example is just showing the usage of "Endpoints_ListManagedProxyDetails" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this EndpointResource created on azure + // for more information of creating EndpointResource, please refer to the document of EndpointResource + string scope = "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/arcGroup/providers/Microsoft.Compute/virtualMachines/vm00006"; + string endpointName = "default"; + ResourceIdentifier endpointResourceId = EndpointResource.CreateResourceIdentifier(scope, endpointName); + EndpointResource endpointResource = client.GetEndpointResource(endpointResourceId); + + // invoke the operation + ManagedProxyContent content = new ManagedProxyContent("127.0.0.1:65035") + { + Hostname = "r.proxy.arc.com", + ServiceName = ServiceName.WAC, + }; + ManagedProxyResource result = await endpointResource.GetManagedProxyDetailsAsync(content); Console.WriteLine($"Succeeded: {result}"); } diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_EndpointResourceCollection.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_EndpointResourceCollection.cs index 1a6b3f780277..3c81f6910e14 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_EndpointResourceCollection.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_EndpointResourceCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_EndpointResourceCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_HybridConnectivityEndpointsGet() { - // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsList.json + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsList.json // this example is just showing the usage of "Endpoints_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -54,7 +54,7 @@ public async Task GetAll_HybridConnectivityEndpointsGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_HybridConnectivityEndpointsGetCustom() { - // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsGetCustom.json + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsGetCustom.json // this example is just showing the usage of "Endpoints_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -86,7 +86,7 @@ public async Task Get_HybridConnectivityEndpointsGetCustom() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_HybridConnectivityEndpointsGetCustom() { - // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsGetCustom.json + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsGetCustom.json // this example is just showing the usage of "Endpoints_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -114,7 +114,7 @@ public async Task Exists_HybridConnectivityEndpointsGetCustom() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_HybridConnectivityEndpointsGetCustom() { - // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsGetCustom.json + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsGetCustom.json // this example is just showing the usage of "Endpoints_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -154,7 +154,7 @@ public async Task GetIfExists_HybridConnectivityEndpointsGetCustom() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_HybridConnectivityEndpointsGetDefault() { - // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsGetDefault.json + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsGetDefault.json // this example is just showing the usage of "Endpoints_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -186,7 +186,7 @@ public async Task Get_HybridConnectivityEndpointsGetDefault() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_HybridConnectivityEndpointsGetDefault() { - // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsGetDefault.json + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsGetDefault.json // this example is just showing the usage of "Endpoints_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -214,7 +214,7 @@ public async Task Exists_HybridConnectivityEndpointsGetDefault() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_HybridConnectivityEndpointsGetDefault() { - // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsGetDefault.json + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsGetDefault.json // this example is just showing the usage of "Endpoints_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -254,7 +254,7 @@ public async Task GetIfExists_HybridConnectivityEndpointsGetDefault() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_HybridConnectivityEndpointsPutCustom() { - // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsPutCustom.json + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsPutCustom.json // this example is just showing the usage of "Endpoints_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -274,8 +274,10 @@ public async Task CreateOrUpdate_HybridConnectivityEndpointsPutCustom() string endpointName = "custom"; EndpointResourceData data = new EndpointResourceData() { - EndpointType = EndpointType.Custom, - ResourceId = "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.Relay/namespaces/custom-relay-namespace", + Properties = new EndpointProperties(EndpointType.Custom) + { + ResourceId = "/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.Relay/namespaces/custom-relay-namespace", + }, }; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, endpointName, data); EndpointResource result = lro.Value; @@ -292,7 +294,7 @@ public async Task CreateOrUpdate_HybridConnectivityEndpointsPutCustom() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_HybridConnectivityEndpointsPutDefault() { - // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2021-10-06-preview/examples/EndpointsPutDefault.json + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/EndpointsPutDefault.json // this example is just showing the usage of "Endpoints_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -312,7 +314,7 @@ public async Task CreateOrUpdate_HybridConnectivityEndpointsPutDefault() string endpointName = "default"; EndpointResourceData data = new EndpointResourceData() { - EndpointType = EndpointType.Default, + Properties = new EndpointProperties(EndpointType.Default), }; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, endpointName, data); EndpointResource result = lro.Value; diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_InventoryResource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_InventoryResource.cs new file mode 100644 index 000000000000..740b5dde8ddd --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_InventoryResource.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.HybridConnectivity.Samples +{ + public partial class Sample_InventoryResource + { + // Inventory_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_InventoryGet() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/Inventory_Get.json + // this example is just showing the usage of "Inventory_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this InventoryResource created on azure + // for more information of creating InventoryResource, please refer to the document of InventoryResource + string resourceUri = "ymuj"; + string solutionConfiguration = "zarfsraogroxlaqjjnwixtn"; + string inventoryId = "xofprmcboosrbd"; + ResourceIdentifier inventoryResourceId = InventoryResource.CreateResourceIdentifier(resourceUri, solutionConfiguration, inventoryId); + InventoryResource inventoryResource = client.GetInventoryResource(inventoryResourceId); + + // invoke the operation + InventoryResource result = await inventoryResource.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InventoryResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_InventoryResourceCollection.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_InventoryResourceCollection.cs new file mode 100644 index 000000000000..b4acdc616298 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_InventoryResourceCollection.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.HybridConnectivity.Samples +{ + public partial class Sample_InventoryResourceCollection + { + // Inventory_ListBySolutionConfiguration + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_InventoryListBySolutionConfiguration() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/Inventory_ListBySolutionConfiguration.json + // this example is just showing the usage of "Inventory_ListBySolutionConfiguration" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SolutionConfigurationResource created on azure + // for more information of creating SolutionConfigurationResource, please refer to the document of SolutionConfigurationResource + string resourceUri = "ymuj"; + string solutionConfiguration = "wsxt"; + ResourceIdentifier solutionConfigurationResourceId = SolutionConfigurationResource.CreateResourceIdentifier(resourceUri, solutionConfiguration); + SolutionConfigurationResource solutionConfiguration0 = client.GetSolutionConfigurationResource(solutionConfigurationResourceId); + + // get the collection of this InventoryResource + InventoryResourceCollection collection = solutionConfiguration0.GetInventoryResources(); + + // invoke the operation and iterate over the result + await foreach (InventoryResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InventoryResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Inventory_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_InventoryGet() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/Inventory_Get.json + // this example is just showing the usage of "Inventory_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SolutionConfigurationResource created on azure + // for more information of creating SolutionConfigurationResource, please refer to the document of SolutionConfigurationResource + string resourceUri = "ymuj"; + string solutionConfiguration = "zarfsraogroxlaqjjnwixtn"; + ResourceIdentifier solutionConfigurationResourceId = SolutionConfigurationResource.CreateResourceIdentifier(resourceUri, solutionConfiguration); + SolutionConfigurationResource solutionConfiguration0 = client.GetSolutionConfigurationResource(solutionConfigurationResourceId); + + // get the collection of this InventoryResource + InventoryResourceCollection collection = solutionConfiguration0.GetInventoryResources(); + + // invoke the operation + string inventoryId = "xofprmcboosrbd"; + InventoryResource result = await collection.GetAsync(inventoryId); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InventoryResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Inventory_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_InventoryGet() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/Inventory_Get.json + // this example is just showing the usage of "Inventory_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SolutionConfigurationResource created on azure + // for more information of creating SolutionConfigurationResource, please refer to the document of SolutionConfigurationResource + string resourceUri = "ymuj"; + string solutionConfiguration = "zarfsraogroxlaqjjnwixtn"; + ResourceIdentifier solutionConfigurationResourceId = SolutionConfigurationResource.CreateResourceIdentifier(resourceUri, solutionConfiguration); + SolutionConfigurationResource solutionConfiguration0 = client.GetSolutionConfigurationResource(solutionConfigurationResourceId); + + // get the collection of this InventoryResource + InventoryResourceCollection collection = solutionConfiguration0.GetInventoryResources(); + + // invoke the operation + string inventoryId = "xofprmcboosrbd"; + bool result = await collection.ExistsAsync(inventoryId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Inventory_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_InventoryGet() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/Inventory_Get.json + // this example is just showing the usage of "Inventory_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SolutionConfigurationResource created on azure + // for more information of creating SolutionConfigurationResource, please refer to the document of SolutionConfigurationResource + string resourceUri = "ymuj"; + string solutionConfiguration = "zarfsraogroxlaqjjnwixtn"; + ResourceIdentifier solutionConfigurationResourceId = SolutionConfigurationResource.CreateResourceIdentifier(resourceUri, solutionConfiguration); + SolutionConfigurationResource solutionConfiguration0 = client.GetSolutionConfigurationResource(solutionConfigurationResourceId); + + // get the collection of this InventoryResource + InventoryResourceCollection collection = solutionConfiguration0.GetInventoryResources(); + + // invoke the operation + string inventoryId = "xofprmcboosrbd"; + NullableResponse response = await collection.GetIfExistsAsync(inventoryId); + InventoryResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InventoryResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_PublicCloudConnectorCollection.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_PublicCloudConnectorCollection.cs new file mode 100644 index 000000000000..4f623ac563ea --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_PublicCloudConnectorCollection.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.HybridConnectivity.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridConnectivity.Samples +{ + public partial class Sample_PublicCloudConnectorCollection + { + // PublicCloudConnectors_ListByResourceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_PublicCloudConnectorsListByResourceGroup() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/PublicCloudConnectors_ListByResourceGroup.json + // this example is just showing the usage of "PublicCloudConnectors_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "5ACC4579-DB34-4C2F-8F8C-25061168F342"; + string resourceGroupName = "rgpublicCloud"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PublicCloudConnectorResource + PublicCloudConnectorCollection collection = resourceGroupResource.GetPublicCloudConnectors(); + + // invoke the operation and iterate over the result + await foreach (PublicCloudConnectorResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PublicCloudConnectorData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // PublicCloudConnectors_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_PublicCloudConnectorsGet() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/PublicCloudConnectors_Get.json + // this example is just showing the usage of "PublicCloudConnectors_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "5ACC4579-DB34-4C2F-8F8C-25061168F342"; + string resourceGroupName = "rgpublicCloud"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PublicCloudConnectorResource + PublicCloudConnectorCollection collection = resourceGroupResource.GetPublicCloudConnectors(); + + // invoke the operation + string publicCloudConnector = "rzygvnpsnrdylwzdbsscjazvamyxmh"; + PublicCloudConnectorResource result = await collection.GetAsync(publicCloudConnector); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PublicCloudConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PublicCloudConnectors_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_PublicCloudConnectorsGet() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/PublicCloudConnectors_Get.json + // this example is just showing the usage of "PublicCloudConnectors_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "5ACC4579-DB34-4C2F-8F8C-25061168F342"; + string resourceGroupName = "rgpublicCloud"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PublicCloudConnectorResource + PublicCloudConnectorCollection collection = resourceGroupResource.GetPublicCloudConnectors(); + + // invoke the operation + string publicCloudConnector = "rzygvnpsnrdylwzdbsscjazvamyxmh"; + bool result = await collection.ExistsAsync(publicCloudConnector); + + Console.WriteLine($"Succeeded: {result}"); + } + + // PublicCloudConnectors_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_PublicCloudConnectorsGet() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/PublicCloudConnectors_Get.json + // this example is just showing the usage of "PublicCloudConnectors_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "5ACC4579-DB34-4C2F-8F8C-25061168F342"; + string resourceGroupName = "rgpublicCloud"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PublicCloudConnectorResource + PublicCloudConnectorCollection collection = resourceGroupResource.GetPublicCloudConnectors(); + + // invoke the operation + string publicCloudConnector = "rzygvnpsnrdylwzdbsscjazvamyxmh"; + NullableResponse response = await collection.GetIfExistsAsync(publicCloudConnector); + PublicCloudConnectorResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PublicCloudConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // PublicCloudConnectors_CreateOrUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_PublicCloudConnectorsCreateOrUpdate() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/PublicCloudConnectors_CreateOrUpdate.json + // this example is just showing the usage of "PublicCloudConnectors_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "5ACC4579-DB34-4C2F-8F8C-25061168F342"; + string resourceGroupName = "rgpublicCloud"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PublicCloudConnectorResource + PublicCloudConnectorCollection collection = resourceGroupResource.GetPublicCloudConnectors(); + + // invoke the operation + string publicCloudConnector = "advjwoakdusalamomg"; + PublicCloudConnectorData data = new PublicCloudConnectorData(new AzureLocation("jpiglusfxynfcewcjwvvnn")) + { + Properties = new PublicCloudConnectorProperties(new AwsCloudProfile("snbnuxckevyqpm") + { + ExcludedAccounts = +{ +"rwgqpukglvbqmogqcliqolucp" +}, + IsOrganizationalAccount = true, + }, HostType.AWS), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, publicCloudConnector, data); + PublicCloudConnectorResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PublicCloudConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_PublicCloudConnectorResource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_PublicCloudConnectorResource.cs new file mode 100644 index 000000000000..3fc3d4642cb6 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_PublicCloudConnectorResource.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.HybridConnectivity.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridConnectivity.Samples +{ + public partial class Sample_PublicCloudConnectorResource + { + // PublicCloudConnectors_ListBySubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetPublicCloudConnectors_PublicCloudConnectorsListBySubscription() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/PublicCloudConnectors_ListBySubscription.json + // this example is just showing the usage of "PublicCloudConnectors_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "5ACC4579-DB34-4C2F-8F8C-25061168F342"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (PublicCloudConnectorResource item in subscriptionResource.GetPublicCloudConnectorsAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PublicCloudConnectorData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // PublicCloudConnectors_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_PublicCloudConnectorsGet() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/PublicCloudConnectors_Get.json + // this example is just showing the usage of "PublicCloudConnectors_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublicCloudConnectorResource created on azure + // for more information of creating PublicCloudConnectorResource, please refer to the document of PublicCloudConnectorResource + string subscriptionId = "5ACC4579-DB34-4C2F-8F8C-25061168F342"; + string resourceGroupName = "rgpublicCloud"; + string publicCloudConnector = "rzygvnpsnrdylwzdbsscjazvamyxmh"; + ResourceIdentifier publicCloudConnectorResourceId = PublicCloudConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publicCloudConnector); + PublicCloudConnectorResource publicCloudConnector0 = client.GetPublicCloudConnectorResource(publicCloudConnectorResourceId); + + // invoke the operation + PublicCloudConnectorResource result = await publicCloudConnector0.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PublicCloudConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PublicCloudConnectors_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_PublicCloudConnectorsUpdate() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/PublicCloudConnectors_Update.json + // this example is just showing the usage of "PublicCloudConnectors_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublicCloudConnectorResource created on azure + // for more information of creating PublicCloudConnectorResource, please refer to the document of PublicCloudConnectorResource + string subscriptionId = "5ACC4579-DB34-4C2F-8F8C-25061168F342"; + string resourceGroupName = "rgpublicCloud"; + string publicCloudConnector = "svtirlbyqpepbzyessjenlueeznhg"; + ResourceIdentifier publicCloudConnectorResourceId = PublicCloudConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publicCloudConnector); + PublicCloudConnectorResource publicCloudConnector0 = client.GetPublicCloudConnectorResource(publicCloudConnectorResourceId); + + // invoke the operation + PublicCloudConnectorPatch patch = new PublicCloudConnectorPatch() + { + AwsCloudExcludedAccounts = +{ +"zrbtd" +}, + Tags = +{ +}, + }; + PublicCloudConnectorResource result = await publicCloudConnector0.UpdateAsync(patch); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PublicCloudConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PublicCloudConnectors_Delete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_PublicCloudConnectorsDelete() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/PublicCloudConnectors_Delete.json + // this example is just showing the usage of "PublicCloudConnectors_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublicCloudConnectorResource created on azure + // for more information of creating PublicCloudConnectorResource, please refer to the document of PublicCloudConnectorResource + string subscriptionId = "5ACC4579-DB34-4C2F-8F8C-25061168F342"; + string resourceGroupName = "rgpublicCloud"; + string publicCloudConnector = "skcfyjvflkhibdywjay"; + ResourceIdentifier publicCloudConnectorResourceId = PublicCloudConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publicCloudConnector); + PublicCloudConnectorResource publicCloudConnector0 = client.GetPublicCloudConnectorResource(publicCloudConnectorResourceId); + + // invoke the operation + await publicCloudConnector0.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // PublicCloudConnectors_TestPermissions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task TestPermissions_PublicCloudConnectorsTestPermissions() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/PublicCloudConnectors_TestPermissions.json + // this example is just showing the usage of "PublicCloudConnectors_TestPermissions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublicCloudConnectorResource created on azure + // for more information of creating PublicCloudConnectorResource, please refer to the document of PublicCloudConnectorResource + string subscriptionId = "5ACC4579-DB34-4C2F-8F8C-25061168F342"; + string resourceGroupName = "rgpublicCloud"; + string publicCloudConnector = "rzygvnpsnrdylwzdbsscjazvamyxmh"; + ResourceIdentifier publicCloudConnectorResourceId = PublicCloudConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publicCloudConnector); + PublicCloudConnectorResource publicCloudConnector0 = client.GetPublicCloudConnectorResource(publicCloudConnectorResourceId); + + // invoke the operation + ArmOperation lro = await publicCloudConnector0.TestPermissionsAsync(WaitUntil.Completed); + OperationStatusResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_ServiceConfigurationResource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_ServiceConfigurationResource.cs new file mode 100644 index 000000000000..d18107eeaaab --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_ServiceConfigurationResource.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.HybridConnectivity.Models; + +namespace Azure.ResourceManager.HybridConnectivity.Samples +{ + public partial class Sample_ServiceConfigurationResource + { + // HybridConnectivityEndpointsServiceconfigurationsGetSSH + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_HybridConnectivityEndpointsServiceconfigurationsGetSSH() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/ServiceConfigurationsGetSSH.json + // this example is just showing the usage of "ServiceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ServiceConfigurationResource created on azure + // for more information of creating ServiceConfigurationResource, please refer to the document of ServiceConfigurationResource + string scope = "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"; + string endpointName = "default"; + string serviceConfigurationName = "SSH"; + ResourceIdentifier serviceConfigurationResourceId = ServiceConfigurationResource.CreateResourceIdentifier(scope, endpointName, serviceConfigurationName); + ServiceConfigurationResource serviceConfigurationResource = client.GetServiceConfigurationResource(serviceConfigurationResourceId); + + // invoke the operation + ServiceConfigurationResource result = await serviceConfigurationResource.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ServiceConfigurationResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // HybridConnectivityEndpointsServiceconfigurationsGetWAC + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_HybridConnectivityEndpointsServiceconfigurationsGetWAC() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/ServiceConfigurationsGetWAC.json + // this example is just showing the usage of "ServiceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ServiceConfigurationResource created on azure + // for more information of creating ServiceConfigurationResource, please refer to the document of ServiceConfigurationResource + string scope = "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"; + string endpointName = "default"; + string serviceConfigurationName = "WAC"; + ResourceIdentifier serviceConfigurationResourceId = ServiceConfigurationResource.CreateResourceIdentifier(scope, endpointName, serviceConfigurationName); + ServiceConfigurationResource serviceConfigurationResource = client.GetServiceConfigurationResource(serviceConfigurationResourceId); + + // invoke the operation + ServiceConfigurationResource result = await serviceConfigurationResource.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ServiceConfigurationResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ServiceConfigurationsPatchSSH + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ServiceConfigurationsPatchSSH() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/ServiceConfigurationsPatchSSH.json + // this example is just showing the usage of "ServiceConfigurations_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ServiceConfigurationResource created on azure + // for more information of creating ServiceConfigurationResource, please refer to the document of ServiceConfigurationResource + string scope = "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"; + string endpointName = "default"; + string serviceConfigurationName = "SSH"; + ResourceIdentifier serviceConfigurationResourceId = ServiceConfigurationResource.CreateResourceIdentifier(scope, endpointName, serviceConfigurationName); + ServiceConfigurationResource serviceConfigurationResource = client.GetServiceConfigurationResource(serviceConfigurationResourceId); + + // invoke the operation + ServiceConfigurationResourcePatch patch = new ServiceConfigurationResourcePatch() + { + Port = 22, + }; + ServiceConfigurationResource result = await serviceConfigurationResource.UpdateAsync(patch); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ServiceConfigurationResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ServiceConfigurationsDeleteSSH + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ServiceConfigurationsDeleteSSH() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/ServiceConfigurationsDeleteSSH.json + // this example is just showing the usage of "ServiceConfigurations_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ServiceConfigurationResource created on azure + // for more information of creating ServiceConfigurationResource, please refer to the document of ServiceConfigurationResource + string scope = "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"; + string endpointName = "default"; + string serviceConfigurationName = "SSH"; + ResourceIdentifier serviceConfigurationResourceId = ServiceConfigurationResource.CreateResourceIdentifier(scope, endpointName, serviceConfigurationName); + ServiceConfigurationResource serviceConfigurationResource = client.GetServiceConfigurationResource(serviceConfigurationResourceId); + + // invoke the operation + await serviceConfigurationResource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_ServiceConfigurationResourceCollection.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_ServiceConfigurationResourceCollection.cs new file mode 100644 index 000000000000..0e56d5156248 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_ServiceConfigurationResourceCollection.cs @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.HybridConnectivity.Models; + +namespace Azure.ResourceManager.HybridConnectivity.Samples +{ + public partial class Sample_ServiceConfigurationResourceCollection + { + // GetClustersExample + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetClustersExample() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/ServiceConfigurationsList.json + // this example is just showing the usage of "ServiceConfigurations_ListByEndpointResource" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this EndpointResource created on azure + // for more information of creating EndpointResource, please refer to the document of EndpointResource + string scope = "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"; + string endpointName = "default"; + ResourceIdentifier endpointResourceId = EndpointResource.CreateResourceIdentifier(scope, endpointName); + EndpointResource endpointResource = client.GetEndpointResource(endpointResourceId); + + // get the collection of this ServiceConfigurationResource + ServiceConfigurationResourceCollection collection = endpointResource.GetServiceConfigurationResources(); + + // invoke the operation and iterate over the result + await foreach (ServiceConfigurationResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ServiceConfigurationResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // HybridConnectivityEndpointsServiceconfigurationsGetSSH + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_HybridConnectivityEndpointsServiceconfigurationsGetSSH() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/ServiceConfigurationsGetSSH.json + // this example is just showing the usage of "ServiceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this EndpointResource created on azure + // for more information of creating EndpointResource, please refer to the document of EndpointResource + string scope = "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"; + string endpointName = "default"; + ResourceIdentifier endpointResourceId = EndpointResource.CreateResourceIdentifier(scope, endpointName); + EndpointResource endpointResource = client.GetEndpointResource(endpointResourceId); + + // get the collection of this ServiceConfigurationResource + ServiceConfigurationResourceCollection collection = endpointResource.GetServiceConfigurationResources(); + + // invoke the operation + string serviceConfigurationName = "SSH"; + ServiceConfigurationResource result = await collection.GetAsync(serviceConfigurationName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ServiceConfigurationResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // HybridConnectivityEndpointsServiceconfigurationsGetSSH + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_HybridConnectivityEndpointsServiceconfigurationsGetSSH() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/ServiceConfigurationsGetSSH.json + // this example is just showing the usage of "ServiceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this EndpointResource created on azure + // for more information of creating EndpointResource, please refer to the document of EndpointResource + string scope = "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"; + string endpointName = "default"; + ResourceIdentifier endpointResourceId = EndpointResource.CreateResourceIdentifier(scope, endpointName); + EndpointResource endpointResource = client.GetEndpointResource(endpointResourceId); + + // get the collection of this ServiceConfigurationResource + ServiceConfigurationResourceCollection collection = endpointResource.GetServiceConfigurationResources(); + + // invoke the operation + string serviceConfigurationName = "SSH"; + bool result = await collection.ExistsAsync(serviceConfigurationName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // HybridConnectivityEndpointsServiceconfigurationsGetSSH + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_HybridConnectivityEndpointsServiceconfigurationsGetSSH() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/ServiceConfigurationsGetSSH.json + // this example is just showing the usage of "ServiceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this EndpointResource created on azure + // for more information of creating EndpointResource, please refer to the document of EndpointResource + string scope = "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"; + string endpointName = "default"; + ResourceIdentifier endpointResourceId = EndpointResource.CreateResourceIdentifier(scope, endpointName); + EndpointResource endpointResource = client.GetEndpointResource(endpointResourceId); + + // get the collection of this ServiceConfigurationResource + ServiceConfigurationResourceCollection collection = endpointResource.GetServiceConfigurationResources(); + + // invoke the operation + string serviceConfigurationName = "SSH"; + NullableResponse response = await collection.GetIfExistsAsync(serviceConfigurationName); + ServiceConfigurationResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ServiceConfigurationResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // HybridConnectivityEndpointsServiceconfigurationsGetWAC + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_HybridConnectivityEndpointsServiceconfigurationsGetWAC() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/ServiceConfigurationsGetWAC.json + // this example is just showing the usage of "ServiceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this EndpointResource created on azure + // for more information of creating EndpointResource, please refer to the document of EndpointResource + string scope = "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"; + string endpointName = "default"; + ResourceIdentifier endpointResourceId = EndpointResource.CreateResourceIdentifier(scope, endpointName); + EndpointResource endpointResource = client.GetEndpointResource(endpointResourceId); + + // get the collection of this ServiceConfigurationResource + ServiceConfigurationResourceCollection collection = endpointResource.GetServiceConfigurationResources(); + + // invoke the operation + string serviceConfigurationName = "WAC"; + ServiceConfigurationResource result = await collection.GetAsync(serviceConfigurationName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ServiceConfigurationResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // HybridConnectivityEndpointsServiceconfigurationsGetWAC + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_HybridConnectivityEndpointsServiceconfigurationsGetWAC() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/ServiceConfigurationsGetWAC.json + // this example is just showing the usage of "ServiceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this EndpointResource created on azure + // for more information of creating EndpointResource, please refer to the document of EndpointResource + string scope = "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"; + string endpointName = "default"; + ResourceIdentifier endpointResourceId = EndpointResource.CreateResourceIdentifier(scope, endpointName); + EndpointResource endpointResource = client.GetEndpointResource(endpointResourceId); + + // get the collection of this ServiceConfigurationResource + ServiceConfigurationResourceCollection collection = endpointResource.GetServiceConfigurationResources(); + + // invoke the operation + string serviceConfigurationName = "WAC"; + bool result = await collection.ExistsAsync(serviceConfigurationName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // HybridConnectivityEndpointsServiceconfigurationsGetWAC + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_HybridConnectivityEndpointsServiceconfigurationsGetWAC() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/ServiceConfigurationsGetWAC.json + // this example is just showing the usage of "ServiceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this EndpointResource created on azure + // for more information of creating EndpointResource, please refer to the document of EndpointResource + string scope = "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"; + string endpointName = "default"; + ResourceIdentifier endpointResourceId = EndpointResource.CreateResourceIdentifier(scope, endpointName); + EndpointResource endpointResource = client.GetEndpointResource(endpointResourceId); + + // get the collection of this ServiceConfigurationResource + ServiceConfigurationResourceCollection collection = endpointResource.GetServiceConfigurationResources(); + + // invoke the operation + string serviceConfigurationName = "WAC"; + NullableResponse response = await collection.GetIfExistsAsync(serviceConfigurationName); + ServiceConfigurationResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ServiceConfigurationResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ServiceConfigurationsPutSSH + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ServiceConfigurationsPutSSH() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/ServiceConfigurationsPutSSH.json + // this example is just showing the usage of "ServiceConfigurations_CreateOrupdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this EndpointResource created on azure + // for more information of creating EndpointResource, please refer to the document of EndpointResource + string scope = "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"; + string endpointName = "default"; + ResourceIdentifier endpointResourceId = EndpointResource.CreateResourceIdentifier(scope, endpointName); + EndpointResource endpointResource = client.GetEndpointResource(endpointResourceId); + + // get the collection of this ServiceConfigurationResource + ServiceConfigurationResourceCollection collection = endpointResource.GetServiceConfigurationResources(); + + // invoke the operation + string serviceConfigurationName = "SSH"; + ServiceConfigurationResourceData data = new ServiceConfigurationResourceData() + { + ServiceName = ServiceName.SSH, + Port = 22, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serviceConfigurationName, data); + ServiceConfigurationResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ServiceConfigurationResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ServiceConfigurationsPutWAC + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ServiceConfigurationsPutWAC() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/stable/2024-12-01/examples/ServiceConfigurationsPutWAC.json + // this example is just showing the usage of "ServiceConfigurations_CreateOrupdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this EndpointResource created on azure + // for more information of creating EndpointResource, please refer to the document of EndpointResource + string scope = "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default"; + string endpointName = "default"; + ResourceIdentifier endpointResourceId = EndpointResource.CreateResourceIdentifier(scope, endpointName); + EndpointResource endpointResource = client.GetEndpointResource(endpointResourceId); + + // get the collection of this ServiceConfigurationResource + ServiceConfigurationResourceCollection collection = endpointResource.GetServiceConfigurationResources(); + + // invoke the operation + string serviceConfigurationName = "WAC"; + ServiceConfigurationResourceData data = new ServiceConfigurationResourceData() + { + ServiceName = ServiceName.WAC, + Port = 6516, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serviceConfigurationName, data); + ServiceConfigurationResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ServiceConfigurationResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_SolutionConfigurationCollection.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_SolutionConfigurationCollection.cs new file mode 100644 index 000000000000..9a492f8b26c3 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_SolutionConfigurationCollection.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.HybridConnectivity.Models; + +namespace Azure.ResourceManager.HybridConnectivity.Samples +{ + public partial class Sample_SolutionConfigurationCollection + { + // SolutionConfigurations_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_SolutionConfigurationsList() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionConfigurations_List.json + // this example is just showing the usage of "SolutionConfigurations_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this SolutionConfigurationResource + string resourceUri = "ymuj"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); + SolutionConfigurationCollection collection = client.GetSolutionConfigurations(scopeId); + + // invoke the operation and iterate over the result + await foreach (SolutionConfigurationResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SolutionConfigurationData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // SolutionConfigurations_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_SolutionConfigurationsGet() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionConfigurations_Get.json + // this example is just showing the usage of "SolutionConfigurations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this SolutionConfigurationResource + string resourceUri = "ymuj"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); + SolutionConfigurationCollection collection = client.GetSolutionConfigurations(scopeId); + + // invoke the operation + string solutionConfiguration = "tks"; + SolutionConfigurationResource result = await collection.GetAsync(solutionConfiguration); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SolutionConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // SolutionConfigurations_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_SolutionConfigurationsGet() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionConfigurations_Get.json + // this example is just showing the usage of "SolutionConfigurations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this SolutionConfigurationResource + string resourceUri = "ymuj"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); + SolutionConfigurationCollection collection = client.GetSolutionConfigurations(scopeId); + + // invoke the operation + string solutionConfiguration = "tks"; + bool result = await collection.ExistsAsync(solutionConfiguration); + + Console.WriteLine($"Succeeded: {result}"); + } + + // SolutionConfigurations_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SolutionConfigurationsGet() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionConfigurations_Get.json + // this example is just showing the usage of "SolutionConfigurations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this SolutionConfigurationResource + string resourceUri = "ymuj"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); + SolutionConfigurationCollection collection = client.GetSolutionConfigurations(scopeId); + + // invoke the operation + string solutionConfiguration = "tks"; + NullableResponse response = await collection.GetIfExistsAsync(solutionConfiguration); + SolutionConfigurationResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SolutionConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // SolutionConfigurations_CreateOrUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_SolutionConfigurationsCreateOrUpdate() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionConfigurations_CreateOrUpdate.json + // this example is just showing the usage of "SolutionConfigurations_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this SolutionConfigurationResource + string resourceUri = "ymuj"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); + SolutionConfigurationCollection collection = client.GetSolutionConfigurations(scopeId); + + // invoke the operation + string solutionConfiguration = "keebwujt"; + SolutionConfigurationData data = new SolutionConfigurationData() + { + Properties = new SolutionConfigurationProperties("nmtqllkyohwtsthxaimsye") + { + SolutionSettings = +{ +}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, solutionConfiguration, data); + SolutionConfigurationResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SolutionConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_SolutionConfigurationResource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_SolutionConfigurationResource.cs new file mode 100644 index 000000000000..de34c88c4c6a --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_SolutionConfigurationResource.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.HybridConnectivity.Models; + +namespace Azure.ResourceManager.HybridConnectivity.Samples +{ + public partial class Sample_SolutionConfigurationResource + { + // SolutionConfigurations_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_SolutionConfigurationsGet() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionConfigurations_Get.json + // this example is just showing the usage of "SolutionConfigurations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SolutionConfigurationResource created on azure + // for more information of creating SolutionConfigurationResource, please refer to the document of SolutionConfigurationResource + string resourceUri = "ymuj"; + string solutionConfiguration = "tks"; + ResourceIdentifier solutionConfigurationResourceId = SolutionConfigurationResource.CreateResourceIdentifier(resourceUri, solutionConfiguration); + SolutionConfigurationResource solutionConfiguration0 = client.GetSolutionConfigurationResource(solutionConfigurationResourceId); + + // invoke the operation + SolutionConfigurationResource result = await solutionConfiguration0.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SolutionConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // SolutionConfigurations_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_SolutionConfigurationsUpdate() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionConfigurations_Update.json + // this example is just showing the usage of "SolutionConfigurations_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SolutionConfigurationResource created on azure + // for more information of creating SolutionConfigurationResource, please refer to the document of SolutionConfigurationResource + string resourceUri = "ymuj"; + string solutionConfiguration = "dxt"; + ResourceIdentifier solutionConfigurationResourceId = SolutionConfigurationResource.CreateResourceIdentifier(resourceUri, solutionConfiguration); + SolutionConfigurationResource solutionConfiguration0 = client.GetSolutionConfigurationResource(solutionConfigurationResourceId); + + // invoke the operation + SolutionConfigurationPatch patch = new SolutionConfigurationPatch() + { + Properties = new SolutionConfigurationPropertiesUpdate() + { + SolutionType = "myzljlstvmgkp", + SolutionSettings = +{ +}, + }, + }; + SolutionConfigurationResource result = await solutionConfiguration0.UpdateAsync(patch); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SolutionConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // SolutionConfigurations_Delete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_SolutionConfigurationsDelete() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionConfigurations_Delete.json + // this example is just showing the usage of "SolutionConfigurations_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SolutionConfigurationResource created on azure + // for more information of creating SolutionConfigurationResource, please refer to the document of SolutionConfigurationResource + string resourceUri = "ymuj"; + string solutionConfiguration = "stu"; + ResourceIdentifier solutionConfigurationResourceId = SolutionConfigurationResource.CreateResourceIdentifier(resourceUri, solutionConfiguration); + SolutionConfigurationResource solutionConfiguration0 = client.GetSolutionConfigurationResource(solutionConfigurationResourceId); + + // invoke the operation + await solutionConfiguration0.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // SolutionConfigurations_SyncNow + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task SyncNow_SolutionConfigurationsSyncNow() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionConfigurations_SyncNow.json + // this example is just showing the usage of "SolutionConfigurations_SyncNow" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SolutionConfigurationResource created on azure + // for more information of creating SolutionConfigurationResource, please refer to the document of SolutionConfigurationResource + string resourceUri = "ymuj"; + string solutionConfiguration = "tks"; + ResourceIdentifier solutionConfigurationResourceId = SolutionConfigurationResource.CreateResourceIdentifier(resourceUri, solutionConfiguration); + SolutionConfigurationResource solutionConfiguration0 = client.GetSolutionConfigurationResource(solutionConfigurationResourceId); + + // invoke the operation + ArmOperation lro = await solutionConfiguration0.SyncNowAsync(WaitUntil.Completed); + OperationStatusResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_SolutionTypeResource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_SolutionTypeResource.cs new file mode 100644 index 000000000000..06838a9d0301 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_SolutionTypeResource.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridConnectivity.Samples +{ + public partial class Sample_SolutionTypeResource + { + // SolutionTypes_ListBySubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetSolutionTypeResources_SolutionTypesListBySubscription() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionTypes_ListBySubscription.json + // this example is just showing the usage of "SolutionTypes_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "5ACC4579-DB34-4C2F-8F8C-25061168F342"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (SolutionTypeResource item in subscriptionResource.GetSolutionTypeResourcesAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SolutionTypeResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // SolutionTypes_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_SolutionTypesGet() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionTypes_Get.json + // this example is just showing the usage of "SolutionTypes_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SolutionTypeResource created on azure + // for more information of creating SolutionTypeResource, please refer to the document of SolutionTypeResource + string subscriptionId = "5ACC4579-DB34-4C2F-8F8C-25061168F342"; + string resourceGroupName = "rgpublicCloud"; + string solutionType = "lulzqllpu"; + ResourceIdentifier solutionTypeResourceId = SolutionTypeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, solutionType); + SolutionTypeResource solutionTypeResource = client.GetSolutionTypeResource(solutionTypeResourceId); + + // invoke the operation + SolutionTypeResource result = await solutionTypeResource.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SolutionTypeResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_SolutionTypeResourceCollection.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_SolutionTypeResourceCollection.cs new file mode 100644 index 000000000000..c75c8134ed8e --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_SolutionTypeResourceCollection.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridConnectivity.Samples +{ + public partial class Sample_SolutionTypeResourceCollection + { + // SolutionTypes_ListByResourceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_SolutionTypesListByResourceGroup() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionTypes_ListByResourceGroup.json + // this example is just showing the usage of "SolutionTypes_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "5ACC4579-DB34-4C2F-8F8C-25061168F342"; + string resourceGroupName = "rgpublicCloud"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SolutionTypeResource + SolutionTypeResourceCollection collection = resourceGroupResource.GetSolutionTypeResources(); + + // invoke the operation and iterate over the result + await foreach (SolutionTypeResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SolutionTypeResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // SolutionTypes_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_SolutionTypesGet() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionTypes_Get.json + // this example is just showing the usage of "SolutionTypes_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "5ACC4579-DB34-4C2F-8F8C-25061168F342"; + string resourceGroupName = "rgpublicCloud"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SolutionTypeResource + SolutionTypeResourceCollection collection = resourceGroupResource.GetSolutionTypeResources(); + + // invoke the operation + string solutionType = "lulzqllpu"; + SolutionTypeResource result = await collection.GetAsync(solutionType); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SolutionTypeResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // SolutionTypes_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_SolutionTypesGet() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionTypes_Get.json + // this example is just showing the usage of "SolutionTypes_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "5ACC4579-DB34-4C2F-8F8C-25061168F342"; + string resourceGroupName = "rgpublicCloud"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SolutionTypeResource + SolutionTypeResourceCollection collection = resourceGroupResource.GetSolutionTypeResources(); + + // invoke the operation + string solutionType = "lulzqllpu"; + bool result = await collection.ExistsAsync(solutionType); + + Console.WriteLine($"Succeeded: {result}"); + } + + // SolutionTypes_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SolutionTypesGet() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/SolutionTypes_Get.json + // this example is just showing the usage of "SolutionTypes_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "5ACC4579-DB34-4C2F-8F8C-25061168F342"; + string resourceGroupName = "rgpublicCloud"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SolutionTypeResource + SolutionTypeResourceCollection collection = resourceGroupResource.GetSolutionTypeResources(); + + // invoke the operation + string solutionType = "lulzqllpu"; + NullableResponse response = await collection.GetIfExistsAsync(solutionType); + SolutionTypeResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SolutionTypeResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs new file mode 100644 index 000000000000..44c89c53b5c2 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.HybridConnectivity.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridConnectivity.Samples +{ + public partial class Sample_SubscriptionResourceExtensions + { + // GenerateAwsTemplate_Post + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task PostGenerateAwsTemplate_GenerateAwsTemplatePost() + { + // Generated from example definition: specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/PublicCloud/stable/2024-12-01/examples/GenerateAwsTemplate_Post.json + // this example is just showing the usage of "GenerateAwsTemplate_Post" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "5ACC4579-DB34-4C2F-8F8C-25061168F342"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + GenerateAwsTemplateContent content = new GenerateAwsTemplateContent("pnxcfjidglabnwxit") + { + SolutionTypes = +{ +new SolutionTypeSettings("hjyownzpfxwiufmd") +{ +SolutionSettings = +{ +}, +} +}, + }; + BinaryData result = await subscriptionResource.PostGenerateAwsTemplateAsync(content); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ArmHybridConnectivityModelFactory.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ArmHybridConnectivityModelFactory.cs index 4efeec6fe014..ceeebcfa7fbf 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ArmHybridConnectivityModelFactory.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ArmHybridConnectivityModelFactory.cs @@ -6,6 +6,8 @@ #nullable disable using System; +using System.Collections.Generic; +using System.Linq; using Azure.Core; using Azure.ResourceManager.Models; @@ -14,37 +16,277 @@ namespace Azure.ResourceManager.HybridConnectivity.Models /// Model factory for models. public static partial class ArmHybridConnectivityModelFactory { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static SolutionConfigurationData SolutionConfigurationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, SolutionConfigurationProperties properties = null) + { + return new SolutionConfigurationData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The resource provisioning state. + /// The type of the solution. + /// Solution settings. + /// The status of solution configurations. + /// The detailed message of status details. + /// The last time resources were inventoried. + /// A new instance for mocking. + public static SolutionConfigurationProperties SolutionConfigurationProperties(ResourceProvisioningState? provisioningState = null, string solutionType = null, IDictionary solutionSettings = null, SolutionConfigurationStatus? status = null, string statusDetails = null, DateTimeOffset? lastSyncOn = null) + { + solutionSettings ??= new Dictionary(); + + return new SolutionConfigurationProperties( + provisioningState, + solutionType, + solutionSettings, + status, + statusDetails, + lastSyncOn, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static SolutionConfigurationPatch SolutionConfigurationPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, SolutionConfigurationPropertiesUpdate properties = null) + { + return new SolutionConfigurationPatch( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static InventoryResourceData InventoryResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, InventoryProperties properties = null) + { + return new InventoryResourceData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Gets or sets the cloud native resource type. + /// Gets or sets the cloud native resource name. + /// Gets or sets the mapped azure resource id. + /// Gets or sets the status of the inventory. + /// Gets or sets the status details. + /// The resource provisioning state. + /// A new instance for mocking. + public static InventoryProperties InventoryProperties(CloudNativeType? cloudNativeType = null, string cloudNativeResourceId = null, string azureResourceId = null, SolutionConfigurationStatus? status = null, string statusDetails = null, ResourceProvisioningState? provisioningState = null) + { + return new InventoryProperties( + cloudNativeType, + cloudNativeResourceId, + azureResourceId, + status, + statusDetails, + provisioningState, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Fully qualified ID for the async operation. + /// Fully qualified ID of the resource against which the original async operation was started. + /// Name of the async operation. + /// Operation status. + /// Percent of the operation that is complete. + /// The start time of the operation. + /// The end time of the operation. + /// The operations list. + /// If present, details of the operation error. + /// A new instance for mocking. + public static OperationStatusResult OperationStatusResult(ResourceIdentifier id = null, ResourceIdentifier resourceId = null, string name = null, string status = null, float? percentComplete = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, IEnumerable operations = null, ResponseError error = null) + { + operations ??= new List(); + + return new OperationStatusResult( + id, + resourceId, + name, + status, + percentComplete, + startOn, + endOn, + operations?.ToList(), + error, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of public cloud connector. + /// The list of solution types and their settings. + /// A new instance for mocking. + public static GenerateAwsTemplateContent GenerateAwsTemplateContent(string connectorId = null, IEnumerable solutionTypes = null) + { + solutionTypes ??= new List(); + + return new GenerateAwsTemplateContent(connectorId, solutionTypes?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The type of the solution. + /// Solution settings. + /// A new instance for mocking. + public static SolutionTypeSettings SolutionTypeSettings(string solutionType = null, IDictionary solutionSettings = null) + { + solutionSettings ??= new Dictionary(); + + return new SolutionTypeSettings(solutionType, solutionSettings, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static PublicCloudConnectorData PublicCloudConnectorData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, PublicCloudConnectorProperties properties = null) + { + tags ??= new Dictionary(); + + return new PublicCloudConnectorData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Cloud profile for AWS. + /// Host cloud the public cloud connector. + /// The resource provisioning state. + /// Connector primary identifier. + /// A new instance for mocking. + public static PublicCloudConnectorProperties PublicCloudConnectorProperties(AwsCloudProfile awsCloudProfile = null, HostType hostType = default, ResourceProvisioningState? provisioningState = null, string connectorPrimaryIdentifier = null) + { + return new PublicCloudConnectorProperties(awsCloudProfile, hostType, provisioningState, connectorPrimaryIdentifier, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static SolutionTypeResourceData SolutionTypeResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, SolutionTypeProperties properties = null) + { + return new SolutionTypeResourceData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Resource tags. + /// A new instance for mocking. + public static PublicCloudConnectorPatch PublicCloudConnectorPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable awsCloudExcludedAccounts = null, IDictionary tags = null) + { + awsCloudExcludedAccounts ??= new List(); + tags ??= new Dictionary(); + + return new PublicCloudConnectorPatch( + id, + name, + resourceType, + systemData, + awsCloudExcludedAccounts != null ? new PublicCloudConnectorPropertiesUpdate(new AwsCloudProfileUpdate(awsCloudExcludedAccounts?.ToList(), serializedAdditionalRawData: null), serializedAdditionalRawData: null) : null, + tags, + serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// 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). + /// The endpoint properties. /// A new instance for mocking. - public static EndpointResourceData EndpointResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, EndpointType? endpointType = null, string resourceId = null, string provisioningState = null, string createdBy = null, CreatedByType? createdByType = null, DateTimeOffset? createdOn = null, string lastModifiedBy = null, CreatedByType? lastModifiedByType = null, DateTimeOffset? lastModifiedOn = null) + public static EndpointResourceData EndpointResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, EndpointProperties properties = null) { return new EndpointResourceData( id, name, resourceType, systemData, - endpointType, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The type of endpoint. + /// The resource Id of the connectivity endpoint (optional). + /// The resource provisioning state. + /// A new instance for mocking. + public static EndpointProperties EndpointProperties(EndpointType endpointType = default, string resourceId = null, string provisioningState = null) + { + return new EndpointProperties(endpointType, resourceId, provisioningState, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// 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. + /// A new instance for mocking. + public static ServiceConfigurationResourceData ServiceConfigurationResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ServiceName? serviceName = null, string resourceId = null, long? port = null, ProvisioningState? provisioningState = null) + { + return new ServiceConfigurationResourceData( + id, + name, + resourceType, + systemData, + serviceName, resourceId, + port, provisioningState, - createdBy, - createdByType, - createdOn, - lastModifiedBy, - lastModifiedByType, - lastModifiedOn, serializedAdditionalRawData: null); } @@ -54,8 +296,9 @@ public static EndpointResourceData EndpointResourceData(ResourceIdentifier id = /// 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. /// A new instance for mocking. - public static TargetResourceEndpointAccess TargetResourceEndpointAccess(string namespaceName = null, string namespaceNameSuffix = null, string hybridConnectionName = null, string accessKey = null, long? expiresOn = null) + public static TargetResourceEndpointAccess TargetResourceEndpointAccess(string namespaceName = null, string namespaceNameSuffix = null, string hybridConnectionName = null, string accessKey = null, long? expiresOn = null, string serviceConfigurationToken = null) { return new TargetResourceEndpointAccess( namespaceName, @@ -63,7 +306,53 @@ public static TargetResourceEndpointAccess TargetResourceEndpointAccess(string n hybridConnectionName, accessKey, expiresOn, + serviceConfigurationToken, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// 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. + /// A new instance for mocking. + public static IngressGatewayResource IngressGatewayResource(string hostname = null, string serverId = null, Guid? tenantId = null, string namespaceName = null, string namespaceNameSuffix = null, string hybridConnectionName = null, string accessKey = null, long? expiresOn = null, string serviceConfigurationToken = null) + { + return new IngressGatewayResource( + hostname, + serverId, + tenantId, + namespaceName, + namespaceNameSuffix, + hybridConnectionName, + accessKey, + expiresOn, + serviceConfigurationToken, serializedAdditionalRawData: null); } + + /// Initializes a new instance of . + /// The name of the service. + /// The target host name. + /// The name of the service. It is an optional property, if not provided, service configuration tokens issue code would be by passed. + /// A new instance for mocking. + public static ManagedProxyContent ManagedProxyContent(string service = null, string hostname = null, ServiceName? serviceName = null) + { + return new ManagedProxyContent(service, hostname, serviceName, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The short lived proxy name. + /// The expiration time of short lived proxy name in unix epoch. + /// A new instance for mocking. + public static ManagedProxyResource ManagedProxyResource(string proxy = null, long expiresOn = default) + { + return new ManagedProxyResource(proxy, expiresOn, serializedAdditionalRawData: null); + } } } diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResource.cs index dcddee76d2a5..84c98a17dd25 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResource.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResource.cs @@ -87,6 +87,73 @@ 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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. /// @@ -100,7 +167,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -140,7 +207,7 @@ public virtual async Task> GetAsync(CancellationToken /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -180,7 +247,7 @@ public virtual Response Get(CancellationToken cancellationToke /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -224,7 +291,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -268,7 +335,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -310,7 +377,7 @@ public virtual async Task> UpdateAsync(EndpointResour /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -352,7 +419,7 @@ public virtual Response Update(EndpointResourceData data, Canc /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -360,15 +427,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) @@ -391,7 +459,7 @@ public virtual async Task> GetCredentials /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -399,15 +467,180 @@ 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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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/EndpointResourceCollection.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceCollection.cs index fd1c959df501..79704cdaa998 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceCollection.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceCollection.cs @@ -54,7 +54,7 @@ internal EndpointResourceCollection(ArmClient client, ResourceIdentifier id) : b /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -104,7 +104,7 @@ public virtual async Task> CreateOrUpdateAsync(Wa /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -154,7 +154,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -198,7 +198,7 @@ public virtual async Task> GetAsync(string endpointNa /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -242,7 +242,7 @@ public virtual Response Get(string endpointName, CancellationT /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -272,7 +272,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken can /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -302,7 +302,7 @@ public virtual Pageable GetAll(CancellationToken cancellationT /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -344,7 +344,7 @@ public virtual async Task> ExistsAsync(string endpointName, Cance /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -386,7 +386,7 @@ public virtual Response Exists(string endpointName, CancellationToken canc /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -430,7 +430,7 @@ public virtual async Task> GetIfExistsAsync(s /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceData.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceData.Serialization.cs index af2fd590e57e..8e2c8551c825 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceData.Serialization.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceData.Serialization.cs @@ -37,57 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(EndpointType)) - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(EndpointType.Value.ToString()); - } - if (Optional.IsDefined(ResourceId)) - { - writer.WritePropertyName("resourceId"u8); - writer.WriteStringValue(ResourceId); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - 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)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("lastModifiedAt"u8); - writer.WriteStringValue(LastModifiedOn.Value, "O"); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WriteEndObject(); } EndpointResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -110,23 +64,24 @@ internal static EndpointResourceData DeserializeEndpointResourceData(JsonElement { return null; } + EndpointProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - EndpointType? type0 = default; - string resourceId = default; - string provisioningState = default; - string createdBy = default; - Models.CreatedByType? createdByType = default; - DateTimeOffset? createdAt = default; - string lastModifiedBy = default; - Models.CreatedByType? lastModifiedByType = default; - DateTimeOffset? lastModifiedAt = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = EndpointProperties.DeserializeEndpointProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -151,95 +106,6 @@ 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; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -251,15 +117,7 @@ internal static EndpointResourceData DeserializeEndpointResourceData(JsonElement name, type, systemData, - type0, - resourceId, - provisioningState, - createdBy, - createdByType, - createdAt, - lastModifiedBy, - lastModifiedByType, - lastModifiedAt, + properties, serializedAdditionalRawData); } diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceData.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceData.cs index b12d5e6c935b..3feebb3a60bc 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceData.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResourceData.cs @@ -61,47 +61,15 @@ 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). + /// The endpoint properties. /// Keeps track of any properties unknown to the library. - 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, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal EndpointResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, EndpointProperties properties, IDictionary serializedAdditionalRawData) : 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; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// 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 693c2da650d1..15baab5b60ea 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/HybridConnectivityExtensions.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/HybridConnectivityExtensions.cs @@ -10,6 +10,8 @@ using System.Threading.Tasks; using Azure.Core; using Azure.ResourceManager.HybridConnectivity.Mocking; +using Azure.ResourceManager.HybridConnectivity.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.HybridConnectivity { @@ -21,6 +23,112 @@ private static MockableHybridConnectivityArmClient GetMockableHybridConnectivity return client.GetCachedClient(client0 => new MockableHybridConnectivityArmClient(client0)); } + private static MockableHybridConnectivityResourceGroupResource GetMockableHybridConnectivityResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableHybridConnectivityResourceGroupResource(client, resource.Id)); + } + + private static MockableHybridConnectivitySubscriptionResource GetMockableHybridConnectivitySubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableHybridConnectivitySubscriptionResource(client, resource.Id)); + } + + /// + /// Gets a collection of SolutionConfigurationResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// is null. + /// An object representing collection of SolutionConfigurationResources and their operations over a SolutionConfigurationResource. + public static SolutionConfigurationCollection GetSolutionConfigurations(this ArmClient client, ResourceIdentifier scope) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableHybridConnectivityArmClient(client).GetSolutionConfigurations(scope); + } + + /// + /// Get a SolutionConfiguration + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration} + /// + /// + /// Operation Id + /// SolutionConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetSolutionConfigurationAsync(this ArmClient client, ResourceIdentifier scope, string solutionConfiguration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(client, nameof(client)); + + return await GetMockableHybridConnectivityArmClient(client).GetSolutionConfigurationAsync(scope, solutionConfiguration, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a SolutionConfiguration + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration} + /// + /// + /// Operation Id + /// SolutionConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetSolutionConfiguration(this ArmClient client, ResourceIdentifier scope, string solutionConfiguration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableHybridConnectivityArmClient(client).GetSolutionConfiguration(scope, solutionConfiguration, cancellationToken); + } + /// /// Gets a collection of EndpointResources in the ArmClient. /// @@ -52,7 +160,7 @@ public static EndpointResourceCollection GetEndpointResources(this ArmClient cli /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -90,7 +198,7 @@ public static async Task> GetEndpointResourceAsync(th /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -115,6 +223,82 @@ public static Response GetEndpointResource(this ArmClient clie return GetMockableHybridConnectivityArmClient(client).GetEndpointResource(scope, endpointName, cancellationToken); } + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SolutionConfigurationResource GetSolutionConfigurationResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableHybridConnectivityArmClient(client).GetSolutionConfigurationResource(id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static InventoryResource GetInventoryResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableHybridConnectivityArmClient(client).GetInventoryResource(id); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static PublicCloudConnectorResource GetPublicCloudConnectorResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableHybridConnectivityArmClient(client).GetPublicCloudConnectorResource(id); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SolutionTypeResource GetSolutionTypeResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableHybridConnectivityArmClient(client).GetSolutionTypeResource(id); + } + /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. /// You can use to create an from its components. @@ -133,5 +317,418 @@ public static EndpointResource GetEndpointResource(this ArmClient client, Resour return GetMockableHybridConnectivityArmClient(client).GetEndpointResource(id); } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ServiceConfigurationResource GetServiceConfigurationResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableHybridConnectivityArmClient(client).GetServiceConfigurationResource(id); + } + + /// + /// Gets a collection of PublicCloudConnectorResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of PublicCloudConnectorResources and their operations over a PublicCloudConnectorResource. + public static PublicCloudConnectorCollection GetPublicCloudConnectors(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableHybridConnectivityResourceGroupResource(resourceGroupResource).GetPublicCloudConnectors(); + } + + /// + /// Get a PublicCloudConnector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Represent public cloud connectors resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetPublicCloudConnectorAsync(this ResourceGroupResource resourceGroupResource, string publicCloudConnector, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableHybridConnectivityResourceGroupResource(resourceGroupResource).GetPublicCloudConnectorAsync(publicCloudConnector, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a PublicCloudConnector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Represent public cloud connectors resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetPublicCloudConnector(this ResourceGroupResource resourceGroupResource, string publicCloudConnector, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableHybridConnectivityResourceGroupResource(resourceGroupResource).GetPublicCloudConnector(publicCloudConnector, cancellationToken); + } + + /// + /// Gets a collection of SolutionTypeResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of SolutionTypeResources and their operations over a SolutionTypeResource. + public static SolutionTypeResourceCollection GetSolutionTypeResources(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableHybridConnectivityResourceGroupResource(resourceGroupResource).GetSolutionTypeResources(); + } + + /// + /// Get a SolutionTypeResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes/{solutionType} + /// + /// + /// Operation Id + /// SolutionTypes_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Solution Type resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetSolutionTypeResourceAsync(this ResourceGroupResource resourceGroupResource, string solutionType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableHybridConnectivityResourceGroupResource(resourceGroupResource).GetSolutionTypeResourceAsync(solutionType, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a SolutionTypeResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes/{solutionType} + /// + /// + /// Operation Id + /// SolutionTypes_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Solution Type resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetSolutionTypeResource(this ResourceGroupResource resourceGroupResource, string solutionType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableHybridConnectivityResourceGroupResource(resourceGroupResource).GetSolutionTypeResource(solutionType, cancellationToken); + } + + /// + /// Retrieve AWS Cloud Formation template + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/generateAwsTemplate + /// + /// + /// Operation Id + /// GenerateAwsTemplate_Post + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// ConnectorId and SolutionTypes and their properties to Generate AWS CFT Template. + /// The cancellation token to use. + /// or is null. + public static async Task> PostGenerateAwsTemplateAsync(this SubscriptionResource subscriptionResource, GenerateAwsTemplateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableHybridConnectivitySubscriptionResource(subscriptionResource).PostGenerateAwsTemplateAsync(content, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieve AWS Cloud Formation template + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/generateAwsTemplate + /// + /// + /// Operation Id + /// GenerateAwsTemplate_Post + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// ConnectorId and SolutionTypes and their properties to Generate AWS CFT Template. + /// The cancellation token to use. + /// or is null. + public static Response PostGenerateAwsTemplate(this SubscriptionResource subscriptionResource, GenerateAwsTemplateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableHybridConnectivitySubscriptionResource(subscriptionResource).PostGenerateAwsTemplate(content, cancellationToken); + } + + /// + /// List PublicCloudConnector resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/publicCloudConnectors + /// + /// + /// Operation Id + /// PublicCloudConnectors_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetPublicCloudConnectorsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableHybridConnectivitySubscriptionResource(subscriptionResource).GetPublicCloudConnectorsAsync(cancellationToken); + } + + /// + /// List PublicCloudConnector resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/publicCloudConnectors + /// + /// + /// Operation Id + /// PublicCloudConnectors_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetPublicCloudConnectors(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableHybridConnectivitySubscriptionResource(subscriptionResource).GetPublicCloudConnectors(cancellationToken); + } + + /// + /// List SolutionTypeResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/solutionTypes + /// + /// + /// Operation Id + /// SolutionTypes_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetSolutionTypeResourcesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableHybridConnectivitySubscriptionResource(subscriptionResource).GetSolutionTypeResourcesAsync(cancellationToken); + } + + /// + /// List SolutionTypeResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/solutionTypes + /// + /// + /// Operation Id + /// SolutionTypes_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetSolutionTypeResources(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableHybridConnectivitySubscriptionResource(subscriptionResource).GetSolutionTypeResources(cancellationToken); + } } } diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/MockableHybridConnectivityArmClient.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/MockableHybridConnectivityArmClient.cs index bda981c23a3b..6a9722c84b33 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/MockableHybridConnectivityArmClient.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/MockableHybridConnectivityArmClient.cs @@ -37,6 +37,78 @@ private string GetApiVersionOrNull(ResourceType resourceType) return apiVersion; } + /// Gets a collection of SolutionConfigurationResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of SolutionConfigurationResources and their operations over a SolutionConfigurationResource. + public virtual SolutionConfigurationCollection GetSolutionConfigurations(ResourceIdentifier scope) + { + return new SolutionConfigurationCollection(Client, scope); + } + + /// + /// Get a SolutionConfiguration + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration} + /// + /// + /// Operation Id + /// SolutionConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The scope that the resource will apply against. + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSolutionConfigurationAsync(ResourceIdentifier scope, string solutionConfiguration, CancellationToken cancellationToken = default) + { + return await GetSolutionConfigurations(scope).GetAsync(solutionConfiguration, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a SolutionConfiguration + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration} + /// + /// + /// Operation Id + /// SolutionConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The scope that the resource will apply against. + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSolutionConfiguration(ResourceIdentifier scope, string solutionConfiguration, CancellationToken cancellationToken = default) + { + return GetSolutionConfigurations(scope).Get(solutionConfiguration, cancellationToken); + } + /// Gets a collection of EndpointResources in the ArmClient. /// The scope that the resource will apply against. /// An object representing collection of EndpointResources and their operations over a EndpointResource. @@ -58,7 +130,7 @@ public virtual EndpointResourceCollection GetEndpointResources(ResourceIdentifie /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -89,7 +161,7 @@ public virtual async Task> GetEndpointResourceAsync(R /// /// /// Default Api Version - /// 2021-10-06-preview + /// 2024-12-01 /// /// /// Resource @@ -107,6 +179,54 @@ public virtual Response GetEndpointResource(ResourceIdentifier return GetEndpointResources(scope).Get(endpointName, cancellationToken); } + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual SolutionConfigurationResource GetSolutionConfigurationResource(ResourceIdentifier id) + { + SolutionConfigurationResource.ValidateResourceId(id); + return new SolutionConfigurationResource(Client, id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual InventoryResource GetInventoryResource(ResourceIdentifier id) + { + InventoryResource.ValidateResourceId(id); + return new InventoryResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual PublicCloudConnectorResource GetPublicCloudConnectorResource(ResourceIdentifier id) + { + PublicCloudConnectorResource.ValidateResourceId(id); + return new PublicCloudConnectorResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual SolutionTypeResource GetSolutionTypeResource(ResourceIdentifier id) + { + SolutionTypeResource.ValidateResourceId(id); + return new SolutionTypeResource(Client, id); + } + /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. /// You can use to create an from its components. @@ -118,5 +238,17 @@ public virtual EndpointResource GetEndpointResource(ResourceIdentifier id) EndpointResource.ValidateResourceId(id); return new EndpointResource(Client, id); } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ServiceConfigurationResource GetServiceConfigurationResource(ResourceIdentifier id) + { + ServiceConfigurationResource.ValidateResourceId(id); + return new ServiceConfigurationResource(Client, id); + } } } diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/MockableHybridConnectivityResourceGroupResource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/MockableHybridConnectivityResourceGroupResource.cs new file mode 100644 index 000000000000..c3f25222a604 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/MockableHybridConnectivityResourceGroupResource.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableHybridConnectivityResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableHybridConnectivityResourceGroupResource() + { + } + + /// 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 MockableHybridConnectivityResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of PublicCloudConnectorResources in the ResourceGroupResource. + /// An object representing collection of PublicCloudConnectorResources and their operations over a PublicCloudConnectorResource. + public virtual PublicCloudConnectorCollection GetPublicCloudConnectors() + { + return GetCachedClient(client => new PublicCloudConnectorCollection(client, Id)); + } + + /// + /// Get a PublicCloudConnector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Represent public cloud connectors resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPublicCloudConnectorAsync(string publicCloudConnector, CancellationToken cancellationToken = default) + { + return await GetPublicCloudConnectors().GetAsync(publicCloudConnector, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a PublicCloudConnector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Represent public cloud connectors resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPublicCloudConnector(string publicCloudConnector, CancellationToken cancellationToken = default) + { + return GetPublicCloudConnectors().Get(publicCloudConnector, cancellationToken); + } + + /// Gets a collection of SolutionTypeResources in the ResourceGroupResource. + /// An object representing collection of SolutionTypeResources and their operations over a SolutionTypeResource. + public virtual SolutionTypeResourceCollection GetSolutionTypeResources() + { + return GetCachedClient(client => new SolutionTypeResourceCollection(client, Id)); + } + + /// + /// Get a SolutionTypeResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes/{solutionType} + /// + /// + /// Operation Id + /// SolutionTypes_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Solution Type resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSolutionTypeResourceAsync(string solutionType, CancellationToken cancellationToken = default) + { + return await GetSolutionTypeResources().GetAsync(solutionType, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a SolutionTypeResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes/{solutionType} + /// + /// + /// Operation Id + /// SolutionTypes_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Solution Type resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSolutionTypeResource(string solutionType, CancellationToken cancellationToken = default) + { + return GetSolutionTypeResources().Get(solutionType, cancellationToken); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/MockableHybridConnectivitySubscriptionResource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/MockableHybridConnectivitySubscriptionResource.cs new file mode 100644 index 000000000000..a3c4ac386b29 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/MockableHybridConnectivitySubscriptionResource.cs @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridConnectivity.Models; + +namespace Azure.ResourceManager.HybridConnectivity.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableHybridConnectivitySubscriptionResource : ArmResource + { + private ClientDiagnostics _generateAwsTemplateClientDiagnostics; + private GenerateAwsTemplateRestOperations _generateAwsTemplateRestClient; + private ClientDiagnostics _publicCloudConnectorClientDiagnostics; + private PublicCloudConnectorsRestOperations _publicCloudConnectorRestClient; + private ClientDiagnostics _solutionTypeResourceSolutionTypesClientDiagnostics; + private SolutionTypesRestOperations _solutionTypeResourceSolutionTypesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableHybridConnectivitySubscriptionResource() + { + } + + /// 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 MockableHybridConnectivitySubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics GenerateAwsTemplateClientDiagnostics => _generateAwsTemplateClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridConnectivity", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private GenerateAwsTemplateRestOperations GenerateAwsTemplateRestClient => _generateAwsTemplateRestClient ??= new GenerateAwsTemplateRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PublicCloudConnectorClientDiagnostics => _publicCloudConnectorClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridConnectivity", PublicCloudConnectorResource.ResourceType.Namespace, Diagnostics); + private PublicCloudConnectorsRestOperations PublicCloudConnectorRestClient => _publicCloudConnectorRestClient ??= new PublicCloudConnectorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PublicCloudConnectorResource.ResourceType)); + private ClientDiagnostics SolutionTypeResourceSolutionTypesClientDiagnostics => _solutionTypeResourceSolutionTypesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridConnectivity", SolutionTypeResource.ResourceType.Namespace, Diagnostics); + private SolutionTypesRestOperations SolutionTypeResourceSolutionTypesRestClient => _solutionTypeResourceSolutionTypesRestClient ??= new SolutionTypesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SolutionTypeResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Retrieve AWS Cloud Formation template + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/generateAwsTemplate + /// + /// + /// Operation Id + /// GenerateAwsTemplate_Post + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// + /// ConnectorId and SolutionTypes and their properties to Generate AWS CFT Template. + /// The cancellation token to use. + /// is null. + public virtual async Task> PostGenerateAwsTemplateAsync(GenerateAwsTemplateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = GenerateAwsTemplateClientDiagnostics.CreateScope("MockableHybridConnectivitySubscriptionResource.PostGenerateAwsTemplate"); + scope.Start(); + try + { + var response = await GenerateAwsTemplateRestClient.PostAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Retrieve AWS Cloud Formation template + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/generateAwsTemplate + /// + /// + /// Operation Id + /// GenerateAwsTemplate_Post + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// + /// ConnectorId and SolutionTypes and their properties to Generate AWS CFT Template. + /// The cancellation token to use. + /// is null. + public virtual Response PostGenerateAwsTemplate(GenerateAwsTemplateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = GenerateAwsTemplateClientDiagnostics.CreateScope("MockableHybridConnectivitySubscriptionResource.PostGenerateAwsTemplate"); + scope.Start(); + try + { + var response = GenerateAwsTemplateRestClient.Post(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List PublicCloudConnector resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/publicCloudConnectors + /// + /// + /// Operation Id + /// PublicCloudConnectors_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPublicCloudConnectorsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PublicCloudConnectorRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PublicCloudConnectorRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PublicCloudConnectorResource(Client, PublicCloudConnectorData.DeserializePublicCloudConnectorData(e)), PublicCloudConnectorClientDiagnostics, Pipeline, "MockableHybridConnectivitySubscriptionResource.GetPublicCloudConnectors", "value", "nextLink", cancellationToken); + } + + /// + /// List PublicCloudConnector resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/publicCloudConnectors + /// + /// + /// Operation Id + /// PublicCloudConnectors_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPublicCloudConnectors(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PublicCloudConnectorRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PublicCloudConnectorRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PublicCloudConnectorResource(Client, PublicCloudConnectorData.DeserializePublicCloudConnectorData(e)), PublicCloudConnectorClientDiagnostics, Pipeline, "MockableHybridConnectivitySubscriptionResource.GetPublicCloudConnectors", "value", "nextLink", cancellationToken); + } + + /// + /// List SolutionTypeResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/solutionTypes + /// + /// + /// Operation Id + /// SolutionTypes_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSolutionTypeResourcesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SolutionTypeResourceSolutionTypesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SolutionTypeResourceSolutionTypesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SolutionTypeResource(Client, SolutionTypeResourceData.DeserializeSolutionTypeResourceData(e)), SolutionTypeResourceSolutionTypesClientDiagnostics, Pipeline, "MockableHybridConnectivitySubscriptionResource.GetSolutionTypeResources", "value", "nextLink", cancellationToken); + } + + /// + /// List SolutionTypeResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/solutionTypes + /// + /// + /// Operation Id + /// SolutionTypes_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSolutionTypeResources(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SolutionTypeResourceSolutionTypesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SolutionTypeResourceSolutionTypesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SolutionTypeResource(Client, SolutionTypeResourceData.DeserializeSolutionTypeResourceData(e)), SolutionTypeResourceSolutionTypesClientDiagnostics, Pipeline, "MockableHybridConnectivitySubscriptionResource.GetSolutionTypeResources", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/InventoryResource.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/InventoryResource.Serialization.cs new file mode 100644 index 000000000000..6d30d8c27edd --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/InventoryResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.HybridConnectivity +{ + public partial class InventoryResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + InventoryResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + InventoryResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/InventoryResource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/InventoryResource.cs new file mode 100644 index 000000000000..e24b91bd98c7 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/InventoryResource.cs @@ -0,0 +1,170 @@ +// 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.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.HybridConnectivity +{ + /// + /// A Class representing an InventoryResource along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetInventoryResource method. + /// Otherwise you can get one from its parent resource using the GetInventoryResource method. + /// + public partial class InventoryResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The resourceUri. + /// The solutionConfiguration. + /// The inventoryId. + public static ResourceIdentifier CreateResourceIdentifier(string resourceUri, string solutionConfiguration, string inventoryId) + { + var resourceId = $"{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory/{inventoryId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _inventoryResourceInventoryClientDiagnostics; + private readonly InventoryRestOperations _inventoryResourceInventoryRestClient; + private readonly InventoryResourceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridConnectivity/solutionConfigurations/inventory"; + + /// Initializes a new instance of the class for mocking. + protected InventoryResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal InventoryResource(ArmClient client, InventoryResourceData 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 InventoryResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _inventoryResourceInventoryClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridConnectivity", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string inventoryResourceInventoryApiVersion); + _inventoryResourceInventoryRestClient = new InventoryRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, inventoryResourceInventoryApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// 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 InventoryResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a InventoryResource + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory/{inventoryId} + /// + /// + /// Operation Id + /// Inventory_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _inventoryResourceInventoryClientDiagnostics.CreateScope("InventoryResource.Get"); + scope.Start(); + try + { + var response = await _inventoryResourceInventoryRestClient.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 InventoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a InventoryResource + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory/{inventoryId} + /// + /// + /// Operation Id + /// Inventory_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _inventoryResourceInventoryClientDiagnostics.CreateScope("InventoryResource.Get"); + scope.Start(); + try + { + var response = _inventoryResourceInventoryRestClient.Get(Id.Parent.Parent, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InventoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/InventoryResourceCollection.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/InventoryResourceCollection.cs new file mode 100644 index 000000000000..a32714ba6ce6 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/InventoryResourceCollection.cs @@ -0,0 +1,395 @@ +// 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 Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +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 an instance call the GetInventoryResources method from an instance of . + /// + public partial class InventoryResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _inventoryResourceInventoryClientDiagnostics; + private readonly InventoryRestOperations _inventoryResourceInventoryRestClient; + + /// Initializes a new instance of the class for mocking. + protected InventoryResourceCollection() + { + } + + /// 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 InventoryResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _inventoryResourceInventoryClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridConnectivity", InventoryResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(InventoryResource.ResourceType, out string inventoryResourceInventoryApiVersion); + _inventoryResourceInventoryRestClient = new InventoryRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, inventoryResourceInventoryApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SolutionConfigurationResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SolutionConfigurationResource.ResourceType), nameof(id)); + } + + /// + /// Get a InventoryResource + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory/{inventoryId} + /// + /// + /// Operation Id + /// Inventory_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Inventory resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string inventoryId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(inventoryId, nameof(inventoryId)); + + using var scope = _inventoryResourceInventoryClientDiagnostics.CreateScope("InventoryResourceCollection.Get"); + scope.Start(); + try + { + var response = await _inventoryResourceInventoryRestClient.GetAsync(Id.Parent, Id.Name, inventoryId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InventoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a InventoryResource + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory/{inventoryId} + /// + /// + /// Operation Id + /// Inventory_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Inventory resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string inventoryId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(inventoryId, nameof(inventoryId)); + + using var scope = _inventoryResourceInventoryClientDiagnostics.CreateScope("InventoryResourceCollection.Get"); + scope.Start(); + try + { + var response = _inventoryResourceInventoryRestClient.Get(Id.Parent, Id.Name, inventoryId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InventoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List InventoryResource resources by SolutionConfiguration + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory + /// + /// + /// Operation Id + /// Inventory_ListBySolutionConfiguration + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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) => _inventoryResourceInventoryRestClient.CreateListBySolutionConfigurationRequest(Id.Parent, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _inventoryResourceInventoryRestClient.CreateListBySolutionConfigurationNextPageRequest(nextLink, Id.Parent, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new InventoryResource(Client, InventoryResourceData.DeserializeInventoryResourceData(e)), _inventoryResourceInventoryClientDiagnostics, Pipeline, "InventoryResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List InventoryResource resources by SolutionConfiguration + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory + /// + /// + /// Operation Id + /// Inventory_ListBySolutionConfiguration + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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) => _inventoryResourceInventoryRestClient.CreateListBySolutionConfigurationRequest(Id.Parent, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _inventoryResourceInventoryRestClient.CreateListBySolutionConfigurationNextPageRequest(nextLink, Id.Parent, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new InventoryResource(Client, InventoryResourceData.DeserializeInventoryResourceData(e)), _inventoryResourceInventoryClientDiagnostics, Pipeline, "InventoryResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory/{inventoryId} + /// + /// + /// Operation Id + /// Inventory_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Inventory resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string inventoryId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(inventoryId, nameof(inventoryId)); + + using var scope = _inventoryResourceInventoryClientDiagnostics.CreateScope("InventoryResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _inventoryResourceInventoryRestClient.GetAsync(Id.Parent, Id.Name, inventoryId, 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/solutionConfigurations/{solutionConfiguration}/inventory/{inventoryId} + /// + /// + /// Operation Id + /// Inventory_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Inventory resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string inventoryId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(inventoryId, nameof(inventoryId)); + + using var scope = _inventoryResourceInventoryClientDiagnostics.CreateScope("InventoryResourceCollection.Exists"); + scope.Start(); + try + { + var response = _inventoryResourceInventoryRestClient.Get(Id.Parent, Id.Name, inventoryId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory/{inventoryId} + /// + /// + /// Operation Id + /// Inventory_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Inventory resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string inventoryId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(inventoryId, nameof(inventoryId)); + + using var scope = _inventoryResourceInventoryClientDiagnostics.CreateScope("InventoryResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _inventoryResourceInventoryRestClient.GetAsync(Id.Parent, Id.Name, inventoryId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InventoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory/{inventoryId} + /// + /// + /// Operation Id + /// Inventory_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Inventory resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string inventoryId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(inventoryId, nameof(inventoryId)); + + using var scope = _inventoryResourceInventoryClientDiagnostics.CreateScope("InventoryResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _inventoryResourceInventoryRestClient.Get(Id.Parent, Id.Name, inventoryId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InventoryResource(Client, response.Value), 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/InventoryResourceData.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/InventoryResourceData.Serialization.cs new file mode 100644 index 000000000000..8697283a292d --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/InventoryResourceData.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridConnectivity.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridConnectivity +{ + public partial class InventoryResourceData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InventoryResourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + InventoryResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InventoryResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInventoryResourceData(document.RootElement, options); + } + + internal static InventoryResourceData DeserializeInventoryResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InventoryProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = InventoryProperties.DeserializeInventoryProperties(property.Value, options); + continue; + } + 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InventoryResourceData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InventoryResourceData)} does not support writing '{options.Format}' format."); + } + } + + InventoryResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInventoryResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InventoryResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/InventoryResourceData.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/InventoryResourceData.cs new file mode 100644 index 000000000000..d6265a640854 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/InventoryResourceData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridConnectivity.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridConnectivity +{ + /// + /// A class representing the InventoryResource data model. + /// Concrete proxy resource types can be created by aliasing this type using a specific property type. + /// + public partial class InventoryResourceData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public InventoryResourceData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal InventoryResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, InventoryProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public InventoryProperties Properties { get; set; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/LongRunningOperation/OperationStatusResultOperationSource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/LongRunningOperation/OperationStatusResultOperationSource.cs new file mode 100644 index 000000000000..27345abe2bee --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/LongRunningOperation/OperationStatusResultOperationSource.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.HybridConnectivity.Models; + +namespace Azure.ResourceManager.HybridConnectivity +{ + internal class OperationStatusResultOperationSource : IOperationSource + { + OperationStatusResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return OperationStatusResult.DeserializeOperationStatusResult(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return OperationStatusResult.DeserializeOperationStatusResult(document.RootElement); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/LongRunningOperation/PublicCloudConnectorOperationSource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/LongRunningOperation/PublicCloudConnectorOperationSource.cs new file mode 100644 index 000000000000..4cc692165931 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/LongRunningOperation/PublicCloudConnectorOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity +{ + internal class PublicCloudConnectorOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal PublicCloudConnectorOperationSource(ArmClient client) + { + _client = client; + } + + PublicCloudConnectorResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = PublicCloudConnectorData.DeserializePublicCloudConnectorData(document.RootElement); + return new PublicCloudConnectorResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = PublicCloudConnectorData.DeserializePublicCloudConnectorData(document.RootElement); + return new PublicCloudConnectorResource(_client, data); + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/AwsCloudProfile.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/AwsCloudProfile.Serialization.cs new file mode 100644 index 000000000000..3151234a5814 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/AwsCloudProfile.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class AwsCloudProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AwsCloudProfile)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("accountId"u8); + writer.WriteStringValue(AccountId); + if (Optional.IsCollectionDefined(ExcludedAccounts)) + { + writer.WritePropertyName("excludedAccounts"u8); + writer.WriteStartArray(); + foreach (var item in ExcludedAccounts) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(IsOrganizationalAccount)) + { + writer.WritePropertyName("isOrganizationalAccount"u8); + writer.WriteBooleanValue(IsOrganizationalAccount.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AwsCloudProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AwsCloudProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAwsCloudProfile(document.RootElement, options); + } + + internal static AwsCloudProfile DeserializeAwsCloudProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string accountId = default; + IList excludedAccounts = default; + bool? isOrganizationalAccount = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("accountId"u8)) + { + accountId = property.Value.GetString(); + continue; + } + if (property.NameEquals("excludedAccounts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + excludedAccounts = array; + continue; + } + if (property.NameEquals("isOrganizationalAccount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isOrganizationalAccount = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AwsCloudProfile(accountId, excludedAccounts ?? new ChangeTrackingList(), isOrganizationalAccount, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AwsCloudProfile)} does not support writing '{options.Format}' format."); + } + } + + AwsCloudProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAwsCloudProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AwsCloudProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/AwsCloudProfile.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/AwsCloudProfile.cs new file mode 100644 index 000000000000..e5e95b6b58f7 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/AwsCloudProfile.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// cloud profile for AWS. + public partial class AwsCloudProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Account id for the AWS account. + /// is null. + public AwsCloudProfile(string accountId) + { + Argument.AssertNotNull(accountId, nameof(accountId)); + + AccountId = accountId; + ExcludedAccounts = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Account id for the AWS account. + /// List of AWS accounts which need to be excluded. + /// Boolean value that indicates whether the account is organizational or not. True represents organization account, whereas false represents a single account. + /// Keeps track of any properties unknown to the library. + internal AwsCloudProfile(string accountId, IList excludedAccounts, bool? isOrganizationalAccount, IDictionary serializedAdditionalRawData) + { + AccountId = accountId; + ExcludedAccounts = excludedAccounts; + IsOrganizationalAccount = isOrganizationalAccount; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AwsCloudProfile() + { + } + + /// Account id for the AWS account. + public string AccountId { get; set; } + /// List of AWS accounts which need to be excluded. + public IList ExcludedAccounts { get; } + /// Boolean value that indicates whether the account is organizational or not. True represents organization account, whereas false represents a single account. + public bool? IsOrganizationalAccount { get; set; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/AwsCloudProfileUpdate.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/AwsCloudProfileUpdate.Serialization.cs new file mode 100644 index 000000000000..60e1541e77a0 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/AwsCloudProfileUpdate.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + internal partial class AwsCloudProfileUpdate : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AwsCloudProfileUpdate)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(ExcludedAccounts)) + { + writer.WritePropertyName("excludedAccounts"u8); + writer.WriteStartArray(); + foreach (var item in ExcludedAccounts) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AwsCloudProfileUpdate IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AwsCloudProfileUpdate)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAwsCloudProfileUpdate(document.RootElement, options); + } + + internal static AwsCloudProfileUpdate DeserializeAwsCloudProfileUpdate(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList excludedAccounts = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("excludedAccounts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + excludedAccounts = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AwsCloudProfileUpdate(excludedAccounts ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AwsCloudProfileUpdate)} does not support writing '{options.Format}' format."); + } + } + + AwsCloudProfileUpdate IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAwsCloudProfileUpdate(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AwsCloudProfileUpdate)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/AwsCloudProfileUpdate.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/AwsCloudProfileUpdate.cs new file mode 100644 index 000000000000..70271adb5514 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/AwsCloudProfileUpdate.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// cloud profile for AWS. + internal partial class AwsCloudProfileUpdate + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AwsCloudProfileUpdate() + { + ExcludedAccounts = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of AWS accounts which need to be excluded. + /// Keeps track of any properties unknown to the library. + internal AwsCloudProfileUpdate(IList excludedAccounts, IDictionary serializedAdditionalRawData) + { + ExcludedAccounts = excludedAccounts; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of AWS accounts which need to be excluded. + public IList ExcludedAccounts { get; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/CloudNativeType.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/CloudNativeType.cs new file mode 100644 index 000000000000..d7fb04111948 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/CloudNativeType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Cloud Native Type enum. + public readonly partial struct CloudNativeType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CloudNativeType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string Ec2Value = "ec2"; + + /// ec2 enum. + public static CloudNativeType Ec2 { get; } = new CloudNativeType(Ec2Value); + /// Determines if two values are the same. + public static bool operator ==(CloudNativeType left, CloudNativeType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CloudNativeType left, CloudNativeType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CloudNativeType(string value) => new CloudNativeType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CloudNativeType other && Equals(other); + /// + public bool Equals(CloudNativeType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} 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 edb33222828e..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 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 != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 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..b1bd5d409b35 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/EndpointProperties.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class EndpointProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EndpointProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(EndpointType.ToString()); + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + EndpointProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EndpointProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEndpointProperties(document.RootElement, options); + } + + internal static EndpointProperties DeserializeEndpointProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EndpointType type = default; + string resourceId = default; + string provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EndpointProperties(type, resourceId, provisioningState, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EndpointProperties)} does not support writing '{options.Format}' format."); + } + } + + EndpointProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEndpointProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EndpointProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..4f9c6e1dd5a0 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/EndpointProperties.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Endpoint details. + public partial class EndpointProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The type of endpoint. + public EndpointProperties(EndpointType endpointType) + { + EndpointType = endpointType; + } + + /// Initializes a new instance of . + /// The type of endpoint. + /// The resource Id of the connectivity endpoint (optional). + /// The resource provisioning state. + /// Keeps track of any properties unknown to the library. + internal EndpointProperties(EndpointType endpointType, string resourceId, string provisioningState, IDictionary serializedAdditionalRawData) + { + EndpointType = endpointType; + ResourceId = resourceId; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EndpointProperties() + { + } + + /// 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/GenerateAwsTemplateContent.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/GenerateAwsTemplateContent.Serialization.cs new file mode 100644 index 000000000000..befa55f6675b --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/GenerateAwsTemplateContent.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class GenerateAwsTemplateContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GenerateAwsTemplateContent)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("connectorId"u8); + writer.WriteStringValue(ConnectorId); + if (Optional.IsCollectionDefined(SolutionTypes)) + { + writer.WritePropertyName("solutionTypes"u8); + writer.WriteStartArray(); + foreach (var item in SolutionTypes) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + GenerateAwsTemplateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GenerateAwsTemplateContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGenerateAwsTemplateContent(document.RootElement, options); + } + + internal static GenerateAwsTemplateContent DeserializeGenerateAwsTemplateContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string connectorId = default; + IList solutionTypes = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("connectorId"u8)) + { + connectorId = property.Value.GetString(); + continue; + } + if (property.NameEquals("solutionTypes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SolutionTypeSettings.DeserializeSolutionTypeSettings(item, options)); + } + solutionTypes = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GenerateAwsTemplateContent(connectorId, solutionTypes ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(GenerateAwsTemplateContent)} does not support writing '{options.Format}' format."); + } + } + + GenerateAwsTemplateContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGenerateAwsTemplateContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GenerateAwsTemplateContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/GenerateAwsTemplateContent.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/GenerateAwsTemplateContent.cs new file mode 100644 index 000000000000..5deeacfe7182 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/GenerateAwsTemplateContent.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// ConnectorId and SolutionTypes and their properties to Generate AWS CFT Template. + public partial class GenerateAwsTemplateContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of public cloud connector. + /// is null. + public GenerateAwsTemplateContent(string connectorId) + { + Argument.AssertNotNull(connectorId, nameof(connectorId)); + + ConnectorId = connectorId; + SolutionTypes = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The name of public cloud connector. + /// The list of solution types and their settings. + /// Keeps track of any properties unknown to the library. + internal GenerateAwsTemplateContent(string connectorId, IList solutionTypes, IDictionary serializedAdditionalRawData) + { + ConnectorId = connectorId; + SolutionTypes = solutionTypes; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GenerateAwsTemplateContent() + { + } + + /// The name of public cloud connector. + public string ConnectorId { get; } + /// The list of solution types and their settings. + public IList SolutionTypes { get; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/HostType.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/HostType.cs new file mode 100644 index 000000000000..0df86ee07173 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/HostType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Enum of host cloud the public cloud connector is referencing. + public readonly partial struct HostType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HostType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AWSValue = "AWS"; + + /// AWS state. + public static HostType AWS { get; } = new HostType(AWSValue); + /// Determines if two values are the same. + public static bool operator ==(HostType left, HostType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HostType left, HostType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator HostType(string value) => new HostType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HostType other && Equals(other); + /// + public bool Equals(HostType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _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..a6dc5cd80e3c --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/IngressGatewayResource.Serialization.cs @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class IngressGatewayResource : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(IngressGatewayResource)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("ingress"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Hostname)) + { + writer.WritePropertyName("hostname"u8); + writer.WriteStringValue(Hostname); + } + writer.WritePropertyName("aadProfile"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ServerId)) + { + writer.WritePropertyName("serverId"u8); + writer.WriteStringValue(ServerId); + } + if (Optional.IsDefined(TenantId)) + { + writer.WritePropertyName("tenantId"u8); + writer.WriteStringValue(TenantId.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + writer.WritePropertyName("relay"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(NamespaceName)) + { + writer.WritePropertyName("namespaceName"u8); + writer.WriteStringValue(NamespaceName); + } + if (Optional.IsDefined(NamespaceNameSuffix)) + { + writer.WritePropertyName("namespaceNameSuffix"u8); + writer.WriteStringValue(NamespaceNameSuffix); + } + if (Optional.IsDefined(HybridConnectionName)) + { + writer.WritePropertyName("hybridConnectionName"u8); + writer.WriteStringValue(HybridConnectionName); + } + if (options.Format != "W" && Optional.IsDefined(AccessKey)) + { + writer.WritePropertyName("accessKey"u8); + writer.WriteStringValue(AccessKey); + } + if (Optional.IsDefined(ExpiresOn)) + { + writer.WritePropertyName("expiresOn"u8); + writer.WriteNumberValue(ExpiresOn.Value); + } + if (Optional.IsDefined(ServiceConfigurationToken)) + { + writer.WritePropertyName("serviceConfigurationToken"u8); + writer.WriteStringValue(ServiceConfigurationToken); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + IngressGatewayResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(IngressGatewayResource)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeIngressGatewayResource(document.RootElement, options); + } + + internal static IngressGatewayResource DeserializeIngressGatewayResource(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string hostname = default; + string serverId = default; + Guid? tenantId = default; + string namespaceName = default; + string namespaceNameSuffix = default; + string hybridConnectionName = default; + string accessKey = default; + long? expiresOn = default; + string serviceConfigurationToken = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new IngressGatewayResource( + hostname, + serverId, + tenantId, + namespaceName, + namespaceNameSuffix, + hybridConnectionName, + accessKey, + expiresOn, + serviceConfigurationToken, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(IngressGatewayResource)} does not support writing '{options.Format}' format."); + } + } + + IngressGatewayResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeIngressGatewayResource(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(IngressGatewayResource)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..40725c3fd645 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/IngressGatewayResource.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// The ingress gateway access credentials. + public partial class IngressGatewayResource + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal IngressGatewayResource() + { + } + + /// Initializes a new instance of . + /// 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. + /// Keeps track of any properties unknown to the library. + internal IngressGatewayResource(string hostname, string serverId, Guid? tenantId, string namespaceName, string namespaceNameSuffix, string hybridConnectionName, string accessKey, long? expiresOn, string serviceConfigurationToken, IDictionary serializedAdditionalRawData) + { + Hostname = hostname; + ServerId = serverId; + TenantId = tenantId; + NamespaceName = namespaceName; + NamespaceNameSuffix = namespaceNameSuffix; + HybridConnectionName = hybridConnectionName; + AccessKey = accessKey; + ExpiresOn = expiresOn; + ServiceConfigurationToken = serviceConfigurationToken; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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/InventoryProperties.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/InventoryProperties.Serialization.cs new file mode 100644 index 000000000000..1dd8117e7fe1 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/InventoryProperties.Serialization.cs @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class InventoryProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InventoryProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(CloudNativeType)) + { + writer.WritePropertyName("cloudNativeType"u8); + writer.WriteStringValue(CloudNativeType.Value.ToString()); + } + if (Optional.IsDefined(CloudNativeResourceId)) + { + writer.WritePropertyName("cloudNativeResourceId"u8); + writer.WriteStringValue(CloudNativeResourceId); + } + if (Optional.IsDefined(AzureResourceId)) + { + writer.WritePropertyName("azureResourceId"u8); + writer.WriteStringValue(AzureResourceId); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(StatusDetails)) + { + writer.WritePropertyName("statusDetails"u8); + writer.WriteStringValue(StatusDetails); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InventoryProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InventoryProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInventoryProperties(document.RootElement, options); + } + + internal static InventoryProperties DeserializeInventoryProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CloudNativeType? cloudNativeType = default; + string cloudNativeResourceId = default; + string azureResourceId = default; + SolutionConfigurationStatus? status = default; + string statusDetails = default; + ResourceProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("cloudNativeType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cloudNativeType = new CloudNativeType(property.Value.GetString()); + continue; + } + if (property.NameEquals("cloudNativeResourceId"u8)) + { + cloudNativeResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("azureResourceId"u8)) + { + azureResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new SolutionConfigurationStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("statusDetails"u8)) + { + statusDetails = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ResourceProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InventoryProperties( + cloudNativeType, + cloudNativeResourceId, + azureResourceId, + status, + statusDetails, + provisioningState, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InventoryProperties)} does not support writing '{options.Format}' format."); + } + } + + InventoryProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInventoryProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InventoryProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/InventoryProperties.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/InventoryProperties.cs new file mode 100644 index 000000000000..9e39583b3616 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/InventoryProperties.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Definition of inventory. + public partial class InventoryProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public InventoryProperties() + { + } + + /// Initializes a new instance of . + /// Gets or sets the cloud native resource type. + /// Gets or sets the cloud native resource name. + /// Gets or sets the mapped azure resource id. + /// Gets or sets the status of the inventory. + /// Gets or sets the status details. + /// The resource provisioning state. + /// Keeps track of any properties unknown to the library. + internal InventoryProperties(CloudNativeType? cloudNativeType, string cloudNativeResourceId, string azureResourceId, SolutionConfigurationStatus? status, string statusDetails, ResourceProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + CloudNativeType = cloudNativeType; + CloudNativeResourceId = cloudNativeResourceId; + AzureResourceId = azureResourceId; + Status = status; + StatusDetails = statusDetails; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Gets or sets the cloud native resource type. + public CloudNativeType? CloudNativeType { get; set; } + /// Gets or sets the cloud native resource name. + public string CloudNativeResourceId { get; set; } + /// Gets or sets the mapped azure resource id. + public string AzureResourceId { get; set; } + /// Gets or sets the status of the inventory. + public SolutionConfigurationStatus? Status { get; set; } + /// Gets or sets the status details. + public string StatusDetails { get; set; } + /// The resource provisioning state. + public ResourceProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/InventoryResourceListResult.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/InventoryResourceListResult.Serialization.cs new file mode 100644 index 000000000000..a566e83cd663 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/InventoryResourceListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + internal partial class InventoryResourceListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InventoryResourceListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InventoryResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InventoryResourceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInventoryResourceListResult(document.RootElement, options); + } + + internal static InventoryResourceListResult DeserializeInventoryResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(InventoryResourceData.DeserializeInventoryResourceData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InventoryResourceListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InventoryResourceListResult)} does not support writing '{options.Format}' format."); + } + } + + InventoryResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInventoryResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InventoryResourceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/InventoryResourceListResult.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/InventoryResourceListResult.cs new file mode 100644 index 000000000000..b06145f24915 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/InventoryResourceListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// The response of a InventoryResource list operation. + internal partial class InventoryResourceListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The InventoryResource items on this page. + /// is null. + internal InventoryResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The InventoryResource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal InventoryResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InventoryResourceListResult() + { + } + + /// The InventoryResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { 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..df908c857b15 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ListCredentialsContent.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class ListCredentialsContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ListCredentialsContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ServiceName)) + { + writer.WritePropertyName("serviceName"u8); + writer.WriteStringValue(ServiceName.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ListCredentialsContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ListCredentialsContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeListCredentialsContent(document.RootElement, options); + } + + internal static ListCredentialsContent DeserializeListCredentialsContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ServiceName? serviceName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("serviceName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceName = new ServiceName(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ListCredentialsContent(serviceName, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ListCredentialsContent)} does not support writing '{options.Format}' format."); + } + } + + ListCredentialsContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeListCredentialsContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ListCredentialsContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..2e92182ecb24 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ListCredentialsContent.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// The details of the service for which credentials needs to be returned. + public partial class ListCredentialsContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ListCredentialsContent() + { + } + + /// Initializes a new instance of . + /// The name of the service. If not provided, the request will by pass the generation of service configuration token. + /// Keeps track of any properties unknown to the library. + internal ListCredentialsContent(ServiceName? serviceName, IDictionary serializedAdditionalRawData) + { + ServiceName = serviceName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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..8c283e2359e4 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ListIngressGatewayCredentialsContent.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class ListIngressGatewayCredentialsContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ListIngressGatewayCredentialsContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ServiceName)) + { + writer.WritePropertyName("serviceName"u8); + writer.WriteStringValue(ServiceName.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ListIngressGatewayCredentialsContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ListIngressGatewayCredentialsContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeListIngressGatewayCredentialsContent(document.RootElement, options); + } + + internal static ListIngressGatewayCredentialsContent DeserializeListIngressGatewayCredentialsContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ServiceName? serviceName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("serviceName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceName = new ServiceName(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ListIngressGatewayCredentialsContent(serviceName, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ListIngressGatewayCredentialsContent)} does not support writing '{options.Format}' format."); + } + } + + ListIngressGatewayCredentialsContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeListIngressGatewayCredentialsContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ListIngressGatewayCredentialsContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..0df80ae78486 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ListIngressGatewayCredentialsContent.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Represent ListIngressGatewayCredentials Request object. + public partial class ListIngressGatewayCredentialsContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ListIngressGatewayCredentialsContent() + { + } + + /// Initializes a new instance of . + /// The name of the service. + /// Keeps track of any properties unknown to the library. + internal ListIngressGatewayCredentialsContent(ServiceName? serviceName, IDictionary serializedAdditionalRawData) + { + ServiceName = serviceName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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..c83d15e52d39 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyContent.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class ManagedProxyContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedProxyContent)} does not support writing '{format}' format."); + } + + 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()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedProxyContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedProxyContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedProxyContent(document.RootElement, options); + } + + internal static ManagedProxyContent DeserializeManagedProxyContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string service = default; + string hostname = default; + ServiceName? serviceName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("service"u8)) + { + service = property.Value.GetString(); + continue; + } + if (property.NameEquals("hostname"u8)) + { + hostname = property.Value.GetString(); + continue; + } + if (property.NameEquals("serviceName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceName = new ServiceName(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedProxyContent(service, hostname, serviceName, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ManagedProxyContent)} does not support writing '{options.Format}' format."); + } + } + + ManagedProxyContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeManagedProxyContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedProxyContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..7726d3f54d59 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyContent.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Represent ManageProxy Request object. + public partial class ManagedProxyContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the service. + /// is null. + public ManagedProxyContent(string service) + { + Argument.AssertNotNull(service, nameof(service)); + + Service = service; + } + + /// Initializes a new instance of . + /// The name of the service. + /// The target host name. + /// The name of the service. It is an optional property, if not provided, service configuration tokens issue code would be by passed. + /// Keeps track of any properties unknown to the library. + internal ManagedProxyContent(string service, string hostname, ServiceName? serviceName, IDictionary serializedAdditionalRawData) + { + Service = service; + Hostname = hostname; + ServiceName = serviceName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedProxyContent() + { + } + + /// 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..3f8a47f952ce --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyResource.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class ManagedProxyResource : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedProxyResource)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("proxy"u8); + writer.WriteStringValue(Proxy); + writer.WritePropertyName("expiresOn"u8); + writer.WriteNumberValue(ExpiresOn); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedProxyResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedProxyResource)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedProxyResource(document.RootElement, options); + } + + internal static ManagedProxyResource DeserializeManagedProxyResource(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string proxy = default; + long expiresOn = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedProxyResource(proxy, expiresOn, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ManagedProxyResource)} does not support writing '{options.Format}' format."); + } + } + + ManagedProxyResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeManagedProxyResource(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedProxyResource)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..5ab03850ff41 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ManagedProxyResource.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Managed Proxy. + public partial class ManagedProxyResource + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// 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; + } + + /// Initializes a new instance of . + /// The short lived proxy name. + /// The expiration time of short lived proxy name in unix epoch. + /// Keeps track of any properties unknown to the library. + internal ManagedProxyResource(string proxy, long expiresOn, IDictionary serializedAdditionalRawData) + { + Proxy = proxy; + ExpiresOn = expiresOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedProxyResource() + { + } + + /// 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/OperationStatusResult.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/OperationStatusResult.Serialization.cs new file mode 100644 index 000000000000..fd684fa9500e --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/OperationStatusResult.Serialization.cs @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class OperationStatusResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationStatusResult)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W" && Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + if (Optional.IsDefined(PercentComplete)) + { + writer.WritePropertyName("percentComplete"u8); + writer.WriteNumberValue(PercentComplete.Value); + } + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + if (Optional.IsCollectionDefined(Operations)) + { + writer.WritePropertyName("operations"u8); + writer.WriteStartArray(); + foreach (var item in Operations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + JsonSerializer.Serialize(writer, Error); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OperationStatusResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationStatusResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOperationStatusResult(document.RootElement, options); + } + + internal static OperationStatusResult DeserializeOperationStatusResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + ResourceIdentifier resourceId = default; + string name = default; + string status = default; + float? percentComplete = default; + DateTimeOffset? startTime = default; + DateTimeOffset? endTime = default; + IReadOnlyList operations = default; + ResponseError error = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("resourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = property.Value.GetString(); + continue; + } + if (property.NameEquals("percentComplete"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + percentComplete = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("startTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("operations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeOperationStatusResult(item, options)); + } + operations = array; + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OperationStatusResult( + id, + resourceId, + name, + status, + percentComplete, + startTime, + endTime, + operations ?? new ChangeTrackingList(), + error, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OperationStatusResult)} does not support writing '{options.Format}' format."); + } + } + + OperationStatusResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeOperationStatusResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OperationStatusResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/OperationStatusResult.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/OperationStatusResult.cs new file mode 100644 index 000000000000..9b129e1242e7 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/OperationStatusResult.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// The current status of an async operation. + public partial class OperationStatusResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Operation status. + /// is null. + internal OperationStatusResult(string status) + { + Argument.AssertNotNull(status, nameof(status)); + + Status = status; + Operations = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Fully qualified ID for the async operation. + /// Fully qualified ID of the resource against which the original async operation was started. + /// Name of the async operation. + /// Operation status. + /// Percent of the operation that is complete. + /// The start time of the operation. + /// The end time of the operation. + /// The operations list. + /// If present, details of the operation error. + /// Keeps track of any properties unknown to the library. + internal OperationStatusResult(ResourceIdentifier id, ResourceIdentifier resourceId, string name, string status, float? percentComplete, DateTimeOffset? startOn, DateTimeOffset? endOn, IReadOnlyList operations, ResponseError error, IDictionary serializedAdditionalRawData) + { + Id = id; + ResourceId = resourceId; + Name = name; + Status = status; + PercentComplete = percentComplete; + StartOn = startOn; + EndOn = endOn; + Operations = operations; + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OperationStatusResult() + { + } + + /// Fully qualified ID for the async operation. + public ResourceIdentifier Id { get; } + /// Fully qualified ID of the resource against which the original async operation was started. + public ResourceIdentifier ResourceId { get; } + /// Name of the async operation. + public string Name { get; } + /// Operation status. + public string Status { get; } + /// Percent of the operation that is complete. + public float? PercentComplete { get; } + /// The start time of the operation. + public DateTimeOffset? StartOn { get; } + /// The end time of the operation. + public DateTimeOffset? EndOn { get; } + /// The operations list. + public IReadOnlyList Operations { get; } + /// If present, details of the operation error. + public ResponseError Error { 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..83a19166ed65 --- /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 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 != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorListResult.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorListResult.Serialization.cs new file mode 100644 index 000000000000..da8c26834b0b --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + internal partial class PublicCloudConnectorListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PublicCloudConnectorListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PublicCloudConnectorListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PublicCloudConnectorListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePublicCloudConnectorListResult(document.RootElement, options); + } + + internal static PublicCloudConnectorListResult DeserializePublicCloudConnectorListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PublicCloudConnectorData.DeserializePublicCloudConnectorData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PublicCloudConnectorListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PublicCloudConnectorListResult)} does not support writing '{options.Format}' format."); + } + } + + PublicCloudConnectorListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePublicCloudConnectorListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PublicCloudConnectorListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorListResult.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorListResult.cs new file mode 100644 index 000000000000..470233668749 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// The response of a PublicCloudConnector list operation. + internal partial class PublicCloudConnectorListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The PublicCloudConnector items on this page. + /// is null. + internal PublicCloudConnectorListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The PublicCloudConnector items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal PublicCloudConnectorListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PublicCloudConnectorListResult() + { + } + + /// The PublicCloudConnector items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorPatch.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorPatch.Serialization.cs new file mode 100644 index 000000000000..25f45dc723f1 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorPatch.Serialization.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class PublicCloudConnectorPatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PublicCloudConnectorPatch)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + } + + PublicCloudConnectorPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PublicCloudConnectorPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePublicCloudConnectorPatch(document.RootElement, options); + } + + internal static PublicCloudConnectorPatch DeserializePublicCloudConnectorPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PublicCloudConnectorPropertiesUpdate properties = default; + IDictionary tags = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = PublicCloudConnectorPropertiesUpdate.DeserializePublicCloudConnectorPropertiesUpdate(property.Value, options); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PublicCloudConnectorPatch( + id, + name, + type, + systemData, + properties, + tags ?? new ChangeTrackingDictionary(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PublicCloudConnectorPatch)} does not support writing '{options.Format}' format."); + } + } + + PublicCloudConnectorPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePublicCloudConnectorPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PublicCloudConnectorPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorPatch.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorPatch.cs new file mode 100644 index 000000000000..03f0267e037a --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorPatch.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Public Cloud Connector. + public partial class PublicCloudConnectorPatch : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public PublicCloudConnectorPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal PublicCloudConnectorPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PublicCloudConnectorPropertiesUpdate properties, IDictionary tags, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + internal PublicCloudConnectorPropertiesUpdate Properties { get; set; } + /// List of AWS accounts which need to be excluded. + public IList AwsCloudExcludedAccounts + { + get + { + if (Properties is null) + Properties = new PublicCloudConnectorPropertiesUpdate(); + return Properties.AwsCloudExcludedAccounts; + } + } + + /// Resource tags. + public IDictionary Tags { get; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorProperties.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorProperties.Serialization.cs new file mode 100644 index 000000000000..33d37f20574c --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorProperties.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class PublicCloudConnectorProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PublicCloudConnectorProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("awsCloudProfile"u8); + writer.WriteObjectValue(AwsCloudProfile, options); + writer.WritePropertyName("hostType"u8); + writer.WriteStringValue(HostType.ToString()); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ConnectorPrimaryIdentifier)) + { + writer.WritePropertyName("connectorPrimaryIdentifier"u8); + writer.WriteStringValue(ConnectorPrimaryIdentifier); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PublicCloudConnectorProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PublicCloudConnectorProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePublicCloudConnectorProperties(document.RootElement, options); + } + + internal static PublicCloudConnectorProperties DeserializePublicCloudConnectorProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AwsCloudProfile awsCloudProfile = default; + HostType hostType = default; + ResourceProvisioningState? provisioningState = default; + string connectorPrimaryIdentifier = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("awsCloudProfile"u8)) + { + awsCloudProfile = AwsCloudProfile.DeserializeAwsCloudProfile(property.Value, options); + continue; + } + if (property.NameEquals("hostType"u8)) + { + hostType = new HostType(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ResourceProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("connectorPrimaryIdentifier"u8)) + { + connectorPrimaryIdentifier = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PublicCloudConnectorProperties(awsCloudProfile, hostType, provisioningState, connectorPrimaryIdentifier, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PublicCloudConnectorProperties)} does not support writing '{options.Format}' format."); + } + } + + PublicCloudConnectorProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePublicCloudConnectorProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PublicCloudConnectorProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorProperties.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorProperties.cs new file mode 100644 index 000000000000..3b9c17cfccbe --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorProperties.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Properties of public cloud connectors. + public partial class PublicCloudConnectorProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Cloud profile for AWS. + /// Host cloud the public cloud connector. + /// is null. + public PublicCloudConnectorProperties(AwsCloudProfile awsCloudProfile, HostType hostType) + { + Argument.AssertNotNull(awsCloudProfile, nameof(awsCloudProfile)); + + AwsCloudProfile = awsCloudProfile; + HostType = hostType; + } + + /// Initializes a new instance of . + /// Cloud profile for AWS. + /// Host cloud the public cloud connector. + /// The resource provisioning state. + /// Connector primary identifier. + /// Keeps track of any properties unknown to the library. + internal PublicCloudConnectorProperties(AwsCloudProfile awsCloudProfile, HostType hostType, ResourceProvisioningState? provisioningState, string connectorPrimaryIdentifier, IDictionary serializedAdditionalRawData) + { + AwsCloudProfile = awsCloudProfile; + HostType = hostType; + ProvisioningState = provisioningState; + ConnectorPrimaryIdentifier = connectorPrimaryIdentifier; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PublicCloudConnectorProperties() + { + } + + /// Cloud profile for AWS. + public AwsCloudProfile AwsCloudProfile { get; set; } + /// Host cloud the public cloud connector. + public HostType HostType { get; set; } + /// The resource provisioning state. + public ResourceProvisioningState? ProvisioningState { get; } + /// Connector primary identifier. + public string ConnectorPrimaryIdentifier { get; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorPropertiesUpdate.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorPropertiesUpdate.Serialization.cs new file mode 100644 index 000000000000..8f1f39406e2e --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorPropertiesUpdate.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + internal partial class PublicCloudConnectorPropertiesUpdate : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PublicCloudConnectorPropertiesUpdate)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(AwsCloudProfile)) + { + writer.WritePropertyName("awsCloudProfile"u8); + writer.WriteObjectValue(AwsCloudProfile, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PublicCloudConnectorPropertiesUpdate IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PublicCloudConnectorPropertiesUpdate)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePublicCloudConnectorPropertiesUpdate(document.RootElement, options); + } + + internal static PublicCloudConnectorPropertiesUpdate DeserializePublicCloudConnectorPropertiesUpdate(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AwsCloudProfileUpdate awsCloudProfile = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("awsCloudProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + awsCloudProfile = AwsCloudProfileUpdate.DeserializeAwsCloudProfileUpdate(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PublicCloudConnectorPropertiesUpdate(awsCloudProfile, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PublicCloudConnectorPropertiesUpdate)} does not support writing '{options.Format}' format."); + } + } + + PublicCloudConnectorPropertiesUpdate IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePublicCloudConnectorPropertiesUpdate(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PublicCloudConnectorPropertiesUpdate)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorPropertiesUpdate.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorPropertiesUpdate.cs new file mode 100644 index 000000000000..016e9d94d76e --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/PublicCloudConnectorPropertiesUpdate.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Properties of public cloud connectors. + internal partial class PublicCloudConnectorPropertiesUpdate + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public PublicCloudConnectorPropertiesUpdate() + { + } + + /// Initializes a new instance of . + /// Cloud profile for AWS. + /// Keeps track of any properties unknown to the library. + internal PublicCloudConnectorPropertiesUpdate(AwsCloudProfileUpdate awsCloudProfile, IDictionary serializedAdditionalRawData) + { + AwsCloudProfile = awsCloudProfile; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Cloud profile for AWS. + internal AwsCloudProfileUpdate AwsCloudProfile { get; set; } + /// List of AWS accounts which need to be excluded. + public IList AwsCloudExcludedAccounts + { + get + { + if (AwsCloudProfile is null) + AwsCloudProfile = new AwsCloudProfileUpdate(); + return AwsCloudProfile.ExcludedAccounts; + } + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ResourceProvisioningState.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ResourceProvisioningState.cs new file mode 100644 index 000000000000..7b39bd59f202 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ResourceProvisioningState.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// The provisioning state of a resource type. + public readonly partial struct ResourceProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ResourceProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Resource has been created. + public static ResourceProvisioningState Succeeded { get; } = new ResourceProvisioningState(SucceededValue); + /// Resource creation failed. + public static ResourceProvisioningState Failed { get; } = new ResourceProvisioningState(FailedValue); + /// Resource creation was canceled. + public static ResourceProvisioningState Canceled { get; } = new ResourceProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(ResourceProvisioningState left, ResourceProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ResourceProvisioningState left, ResourceProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ResourceProvisioningState(string value) => new ResourceProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ResourceProvisioningState other && Equals(other); + /// + public bool Equals(ResourceProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 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..be1876f939bf --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationList.Serialization.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + internal partial class ServiceConfigurationList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ServiceConfigurationList)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ServiceConfigurationList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ServiceConfigurationList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeServiceConfigurationList(document.RootElement, options); + } + + internal static ServiceConfigurationList DeserializeServiceConfigurationList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ServiceConfigurationList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ServiceConfigurationList)} does not support writing '{options.Format}' format."); + } + } + + ServiceConfigurationList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeServiceConfigurationList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ServiceConfigurationList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..ac7fa853b9e4 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationList.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// The paginated list of serviceConfigurations. + internal partial class ServiceConfigurationList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ServiceConfigurationList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The list of service configuration. + /// The link to fetch the next page of connected cluster. + /// Keeps track of any properties unknown to the library. + internal ServiceConfigurationList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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/ServiceConfigurationResourcePatch.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationResourcePatch.Serialization.cs new file mode 100644 index 000000000000..b4a0fa98e874 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationResourcePatch.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class ServiceConfigurationResourcePatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ServiceConfigurationResourcePatch)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Port)) + { + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port.Value); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ServiceConfigurationResourcePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ServiceConfigurationResourcePatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeServiceConfigurationResourcePatch(document.RootElement, options); + } + + internal static ServiceConfigurationResourcePatch DeserializeServiceConfigurationResourcePatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long? port = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("port"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + port = property0.Value.GetInt64(); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ServiceConfigurationResourcePatch(port, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ServiceConfigurationResourcePatch)} does not support writing '{options.Format}' format."); + } + } + + ServiceConfigurationResourcePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeServiceConfigurationResourcePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ServiceConfigurationResourcePatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..4456b7913291 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/ServiceConfigurationResourcePatch.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// The service details under service configuration for the target endpoint resource. + public partial class ServiceConfigurationResourcePatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ServiceConfigurationResourcePatch() + { + } + + /// Initializes a new instance of . + /// The port on which service is enabled. + /// Keeps track of any properties unknown to the library. + internal ServiceConfigurationResourcePatch(long? port, IDictionary serializedAdditionalRawData) + { + Port = port; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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..fade306b7d02 --- /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 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 != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationListResult.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationListResult.Serialization.cs new file mode 100644 index 000000000000..96ad933380af --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + internal partial class SolutionConfigurationListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionConfigurationListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SolutionConfigurationListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionConfigurationListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSolutionConfigurationListResult(document.RootElement, options); + } + + internal static SolutionConfigurationListResult DeserializeSolutionConfigurationListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SolutionConfigurationData.DeserializeSolutionConfigurationData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SolutionConfigurationListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SolutionConfigurationListResult)} does not support writing '{options.Format}' format."); + } + } + + SolutionConfigurationListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSolutionConfigurationListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SolutionConfigurationListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationListResult.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationListResult.cs new file mode 100644 index 000000000000..4b86d7a296a1 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// The response of a SolutionConfiguration list operation. + internal partial class SolutionConfigurationListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The SolutionConfiguration items on this page. + /// is null. + internal SolutionConfigurationListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The SolutionConfiguration items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SolutionConfigurationListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SolutionConfigurationListResult() + { + } + + /// The SolutionConfiguration items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationPatch.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationPatch.Serialization.cs new file mode 100644 index 000000000000..c44e3632d7c5 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationPatch.Serialization.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class SolutionConfigurationPatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionConfigurationPatch)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + SolutionConfigurationPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionConfigurationPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSolutionConfigurationPatch(document.RootElement, options); + } + + internal static SolutionConfigurationPatch DeserializeSolutionConfigurationPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SolutionConfigurationPropertiesUpdate properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SolutionConfigurationPropertiesUpdate.DeserializeSolutionConfigurationPropertiesUpdate(property.Value, options); + continue; + } + 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SolutionConfigurationPatch( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SolutionConfigurationPatch)} does not support writing '{options.Format}' format."); + } + } + + SolutionConfigurationPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSolutionConfigurationPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SolutionConfigurationPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationPatch.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationPatch.cs new file mode 100644 index 000000000000..a6f93517368d --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationPatch.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Solution Configuration. + public partial class SolutionConfigurationPatch : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SolutionConfigurationPatch() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal SolutionConfigurationPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SolutionConfigurationPropertiesUpdate properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public SolutionConfigurationPropertiesUpdate Properties { get; set; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationProperties.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationProperties.Serialization.cs new file mode 100644 index 000000000000..9adc14546855 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationProperties.Serialization.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class SolutionConfigurationProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionConfigurationProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + writer.WritePropertyName("solutionType"u8); + writer.WriteStringValue(SolutionType); + if (Optional.IsCollectionDefined(SolutionSettings)) + { + writer.WritePropertyName("solutionSettings"u8); + writer.WriteStartObject(); + foreach (var item in SolutionSettings) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(StatusDetails)) + { + writer.WritePropertyName("statusDetails"u8); + writer.WriteStringValue(StatusDetails); + } + if (options.Format != "W" && Optional.IsDefined(LastSyncOn)) + { + writer.WritePropertyName("lastSyncTime"u8); + writer.WriteStringValue(LastSyncOn.Value, "O"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SolutionConfigurationProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionConfigurationProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSolutionConfigurationProperties(document.RootElement, options); + } + + internal static SolutionConfigurationProperties DeserializeSolutionConfigurationProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceProvisioningState? provisioningState = default; + string solutionType = default; + IDictionary solutionSettings = default; + SolutionConfigurationStatus? status = default; + string statusDetails = default; + DateTimeOffset? lastSyncTime = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ResourceProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("solutionType"u8)) + { + solutionType = property.Value.GetString(); + continue; + } + if (property.NameEquals("solutionSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + solutionSettings = dictionary; + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new SolutionConfigurationStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("statusDetails"u8)) + { + statusDetails = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastSyncTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSyncTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SolutionConfigurationProperties( + provisioningState, + solutionType, + solutionSettings ?? new ChangeTrackingDictionary(), + status, + statusDetails, + lastSyncTime, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SolutionConfigurationProperties)} does not support writing '{options.Format}' format."); + } + } + + SolutionConfigurationProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSolutionConfigurationProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SolutionConfigurationProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationProperties.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationProperties.cs new file mode 100644 index 000000000000..7428527c88d7 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationProperties.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Solution configuration resource. + public partial class SolutionConfigurationProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The type of the solution. + /// is null. + public SolutionConfigurationProperties(string solutionType) + { + Argument.AssertNotNull(solutionType, nameof(solutionType)); + + SolutionType = solutionType; + SolutionSettings = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The resource provisioning state. + /// The type of the solution. + /// Solution settings. + /// The status of solution configurations. + /// The detailed message of status details. + /// The last time resources were inventoried. + /// Keeps track of any properties unknown to the library. + internal SolutionConfigurationProperties(ResourceProvisioningState? provisioningState, string solutionType, IDictionary solutionSettings, SolutionConfigurationStatus? status, string statusDetails, DateTimeOffset? lastSyncOn, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + SolutionType = solutionType; + SolutionSettings = solutionSettings; + Status = status; + StatusDetails = statusDetails; + LastSyncOn = lastSyncOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SolutionConfigurationProperties() + { + } + + /// The resource provisioning state. + public ResourceProvisioningState? ProvisioningState { get; } + /// The type of the solution. + public string SolutionType { get; set; } + /// Solution settings. + public IDictionary SolutionSettings { get; } + /// The status of solution configurations. + public SolutionConfigurationStatus? Status { get; } + /// The detailed message of status details. + public string StatusDetails { get; } + /// The last time resources were inventoried. + public DateTimeOffset? LastSyncOn { get; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationPropertiesUpdate.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationPropertiesUpdate.Serialization.cs new file mode 100644 index 000000000000..51d4a68ba0b1 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationPropertiesUpdate.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class SolutionConfigurationPropertiesUpdate : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionConfigurationPropertiesUpdate)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(SolutionType)) + { + writer.WritePropertyName("solutionType"u8); + writer.WriteStringValue(SolutionType); + } + if (Optional.IsCollectionDefined(SolutionSettings)) + { + writer.WritePropertyName("solutionSettings"u8); + writer.WriteStartObject(); + foreach (var item in SolutionSettings) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SolutionConfigurationPropertiesUpdate IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionConfigurationPropertiesUpdate)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSolutionConfigurationPropertiesUpdate(document.RootElement, options); + } + + internal static SolutionConfigurationPropertiesUpdate DeserializeSolutionConfigurationPropertiesUpdate(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string solutionType = default; + IDictionary solutionSettings = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("solutionType"u8)) + { + solutionType = property.Value.GetString(); + continue; + } + if (property.NameEquals("solutionSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + solutionSettings = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SolutionConfigurationPropertiesUpdate(solutionType, solutionSettings ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SolutionConfigurationPropertiesUpdate)} does not support writing '{options.Format}' format."); + } + } + + SolutionConfigurationPropertiesUpdate IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSolutionConfigurationPropertiesUpdate(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SolutionConfigurationPropertiesUpdate)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationPropertiesUpdate.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationPropertiesUpdate.cs new file mode 100644 index 000000000000..c7e22de5b6fe --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationPropertiesUpdate.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Solution configuration resource. + public partial class SolutionConfigurationPropertiesUpdate + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SolutionConfigurationPropertiesUpdate() + { + SolutionSettings = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The type of the solution. + /// Solution settings. + /// Keeps track of any properties unknown to the library. + internal SolutionConfigurationPropertiesUpdate(string solutionType, IDictionary solutionSettings, IDictionary serializedAdditionalRawData) + { + SolutionType = solutionType; + SolutionSettings = solutionSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The type of the solution. + public string SolutionType { get; set; } + /// Solution settings. + public IDictionary SolutionSettings { get; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationStatus.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationStatus.cs new file mode 100644 index 000000000000..b9ab234a1721 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionConfigurationStatus.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Solution Configuration Status. + public readonly partial struct SolutionConfigurationStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SolutionConfigurationStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NewValue = "New"; + private const string InProgressValue = "InProgress"; + private const string CompletedValue = "Completed"; + private const string FailedValue = "Failed"; + + /// New status. + public static SolutionConfigurationStatus New { get; } = new SolutionConfigurationStatus(NewValue); + /// InProgress status. + public static SolutionConfigurationStatus InProgress { get; } = new SolutionConfigurationStatus(InProgressValue); + /// Canceled status. + public static SolutionConfigurationStatus Completed { get; } = new SolutionConfigurationStatus(CompletedValue); + /// Failed status. + public static SolutionConfigurationStatus Failed { get; } = new SolutionConfigurationStatus(FailedValue); + /// Determines if two values are the same. + public static bool operator ==(SolutionConfigurationStatus left, SolutionConfigurationStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SolutionConfigurationStatus left, SolutionConfigurationStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SolutionConfigurationStatus(string value) => new SolutionConfigurationStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SolutionConfigurationStatus other && Equals(other); + /// + public bool Equals(SolutionConfigurationStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeProperties.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeProperties.Serialization.cs new file mode 100644 index 000000000000..eb6b48e03538 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeProperties.Serialization.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class SolutionTypeProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionTypeProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(SolutionType)) + { + writer.WritePropertyName("solutionType"u8); + writer.WriteStringValue(SolutionType); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsCollectionDefined(SupportedAzureRegions)) + { + writer.WritePropertyName("supportedAzureRegions"u8); + writer.WriteStartArray(); + foreach (var item in SupportedAzureRegions) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(SolutionSettings)) + { + writer.WritePropertyName("solutionSettings"u8); + writer.WriteStartArray(); + foreach (var item in SolutionSettings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SolutionTypeProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionTypeProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSolutionTypeProperties(document.RootElement, options); + } + + internal static SolutionTypeProperties DeserializeSolutionTypeProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string solutionType = default; + string description = default; + IList supportedAzureRegions = default; + IList solutionSettings = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("solutionType"u8)) + { + solutionType = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("supportedAzureRegions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + supportedAzureRegions = array; + continue; + } + if (property.NameEquals("solutionSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SolutionTypeSettingsProperties.DeserializeSolutionTypeSettingsProperties(item, options)); + } + solutionSettings = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SolutionTypeProperties(solutionType, description, supportedAzureRegions ?? new ChangeTrackingList(), solutionSettings ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SolutionTypeProperties)} does not support writing '{options.Format}' format."); + } + } + + SolutionTypeProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSolutionTypeProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SolutionTypeProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeProperties.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeProperties.cs new file mode 100644 index 000000000000..0d1b6588e470 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeProperties.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Definition of Solution type resource. + public partial class SolutionTypeProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SolutionTypeProperties() + { + SupportedAzureRegions = new ChangeTrackingList(); + SolutionSettings = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The name of the solution type. + /// Short description of solution type. + /// The locations this solution is supported in. + /// Array of solution settings and its description. + /// Keeps track of any properties unknown to the library. + internal SolutionTypeProperties(string solutionType, string description, IList supportedAzureRegions, IList solutionSettings, IDictionary serializedAdditionalRawData) + { + SolutionType = solutionType; + Description = description; + SupportedAzureRegions = supportedAzureRegions; + SolutionSettings = solutionSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of the solution type. + public string SolutionType { get; set; } + /// Short description of solution type. + public string Description { get; set; } + /// The locations this solution is supported in. + public IList SupportedAzureRegions { get; } + /// Array of solution settings and its description. + public IList SolutionSettings { get; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeResourceListResult.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeResourceListResult.Serialization.cs new file mode 100644 index 000000000000..0a31c1503b84 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeResourceListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + internal partial class SolutionTypeResourceListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionTypeResourceListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SolutionTypeResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionTypeResourceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSolutionTypeResourceListResult(document.RootElement, options); + } + + internal static SolutionTypeResourceListResult DeserializeSolutionTypeResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SolutionTypeResourceData.DeserializeSolutionTypeResourceData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SolutionTypeResourceListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SolutionTypeResourceListResult)} does not support writing '{options.Format}' format."); + } + } + + SolutionTypeResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSolutionTypeResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SolutionTypeResourceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeResourceListResult.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeResourceListResult.cs new file mode 100644 index 000000000000..9f13c5fe866f --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeResourceListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// The response of a SolutionTypeResource list operation. + internal partial class SolutionTypeResourceListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The SolutionTypeResource items on this page. + /// is null. + internal SolutionTypeResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The SolutionTypeResource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SolutionTypeResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SolutionTypeResourceListResult() + { + } + + /// The SolutionTypeResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeSettings.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeSettings.Serialization.cs new file mode 100644 index 000000000000..3a97aff138a4 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeSettings.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class SolutionTypeSettings : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionTypeSettings)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("solutionType"u8); + writer.WriteStringValue(SolutionType); + if (Optional.IsCollectionDefined(SolutionSettings)) + { + writer.WritePropertyName("solutionSettings"u8); + writer.WriteStartObject(); + foreach (var item in SolutionSettings) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SolutionTypeSettings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionTypeSettings)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSolutionTypeSettings(document.RootElement, options); + } + + internal static SolutionTypeSettings DeserializeSolutionTypeSettings(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string solutionType = default; + IDictionary solutionSettings = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("solutionType"u8)) + { + solutionType = property.Value.GetString(); + continue; + } + if (property.NameEquals("solutionSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + solutionSettings = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SolutionTypeSettings(solutionType, solutionSettings ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SolutionTypeSettings)} does not support writing '{options.Format}' format."); + } + } + + SolutionTypeSettings IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSolutionTypeSettings(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SolutionTypeSettings)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeSettings.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeSettings.cs new file mode 100644 index 000000000000..fe9950412671 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeSettings.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// The properties of Solution Type. + public partial class SolutionTypeSettings + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The type of the solution. + /// is null. + public SolutionTypeSettings(string solutionType) + { + Argument.AssertNotNull(solutionType, nameof(solutionType)); + + SolutionType = solutionType; + SolutionSettings = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The type of the solution. + /// Solution settings. + /// Keeps track of any properties unknown to the library. + internal SolutionTypeSettings(string solutionType, IDictionary solutionSettings, IDictionary serializedAdditionalRawData) + { + SolutionType = solutionType; + SolutionSettings = solutionSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SolutionTypeSettings() + { + } + + /// The type of the solution. + public string SolutionType { get; } + /// Solution settings. + public IDictionary SolutionSettings { get; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeSettingsProperties.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeSettingsProperties.Serialization.cs new file mode 100644 index 000000000000..5ed72fee100d --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeSettingsProperties.Serialization.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + public partial class SolutionTypeSettingsProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionTypeSettingsProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(SolutionTypeSettingsPropertiesType); + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + writer.WritePropertyName("allowedValues"u8); + writer.WriteStartArray(); + foreach (var item in AllowedValues) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("defaultValue"u8); + writer.WriteStringValue(DefaultValue); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SolutionTypeSettingsProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionTypeSettingsProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSolutionTypeSettingsProperties(document.RootElement, options); + } + + internal static SolutionTypeSettingsProperties DeserializeSolutionTypeSettingsProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string displayName = default; + string type = default; + string description = default; + IList allowedValues = default; + string defaultValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("allowedValues"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + allowedValues = array; + continue; + } + if (property.NameEquals("defaultValue"u8)) + { + defaultValue = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SolutionTypeSettingsProperties( + name, + displayName, + type, + description, + allowedValues, + defaultValue, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SolutionTypeSettingsProperties)} does not support writing '{options.Format}' format."); + } + } + + SolutionTypeSettingsProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSolutionTypeSettingsProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SolutionTypeSettingsProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeSettingsProperties.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeSettingsProperties.cs new file mode 100644 index 000000000000..7ae060818540 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/SolutionTypeSettingsProperties.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.HybridConnectivity.Models +{ + /// Represent Solution settings properties description array. + public partial class SolutionTypeSettingsProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the solution setting property. + /// The UI friendly name of the solution setting property. + /// Type of the solution setting property, represented as a string. + /// Description of solution setting property. + /// Array of allowed values for this solution settings property. + /// Default value for this solution settings property. + /// , , , , or is null. + public SolutionTypeSettingsProperties(string name, string displayName, string solutionTypeSettingsPropertiesType, string description, IEnumerable allowedValues, string defaultValue) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(displayName, nameof(displayName)); + Argument.AssertNotNull(solutionTypeSettingsPropertiesType, nameof(solutionTypeSettingsPropertiesType)); + Argument.AssertNotNull(description, nameof(description)); + Argument.AssertNotNull(allowedValues, nameof(allowedValues)); + Argument.AssertNotNull(defaultValue, nameof(defaultValue)); + + Name = name; + DisplayName = displayName; + SolutionTypeSettingsPropertiesType = solutionTypeSettingsPropertiesType; + Description = description; + AllowedValues = allowedValues.ToList(); + DefaultValue = defaultValue; + } + + /// Initializes a new instance of . + /// The name of the solution setting property. + /// The UI friendly name of the solution setting property. + /// Type of the solution setting property, represented as a string. + /// Description of solution setting property. + /// Array of allowed values for this solution settings property. + /// Default value for this solution settings property. + /// Keeps track of any properties unknown to the library. + internal SolutionTypeSettingsProperties(string name, string displayName, string solutionTypeSettingsPropertiesType, string description, IList allowedValues, string defaultValue, IDictionary serializedAdditionalRawData) + { + Name = name; + DisplayName = displayName; + SolutionTypeSettingsPropertiesType = solutionTypeSettingsPropertiesType; + Description = description; + AllowedValues = allowedValues; + DefaultValue = defaultValue; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SolutionTypeSettingsProperties() + { + } + + /// The name of the solution setting property. + public string Name { get; set; } + /// The UI friendly name of the solution setting property. + public string DisplayName { get; set; } + /// Type of the solution setting property, represented as a string. + public string SolutionTypeSettingsPropertiesType { get; set; } + /// Description of solution setting property. + public string Description { get; set; } + /// Array of allowed values for this solution settings property. + public IList AllowedValues { get; } + /// Default value for this solution settings property. + public string DefaultValue { get; set; } + } +} 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 cf6fe7511ada..52978fcabaa2 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 @@ -61,6 +61,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("expiresOn"u8); writer.WriteNumberValue(ExpiresOn.Value); } + if (Optional.IsDefined(ServiceConfigurationToken)) + { + writer.WritePropertyName("serviceConfigurationToken"u8); + writer.WriteStringValue(ServiceConfigurationToken); + } writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -104,6 +109,7 @@ internal static TargetResourceEndpointAccess DeserializeTargetResourceEndpointAc string hybridConnectionName = default; string accessKey = default; long? expiresOn = default; + string serviceConfigurationToken = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -146,6 +152,11 @@ internal static TargetResourceEndpointAccess DeserializeTargetResourceEndpointAc expiresOn = property0.Value.GetInt64(); continue; } + if (property0.NameEquals("serviceConfigurationToken"u8)) + { + serviceConfigurationToken = property0.Value.GetString(); + continue; + } } continue; } @@ -161,6 +172,7 @@ internal static TargetResourceEndpointAccess DeserializeTargetResourceEndpointAc hybridConnectionName, accessKey, expiresOn, + serviceConfigurationToken, serializedAdditionalRawData); } 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 d9c3c1eef078..e79427d11cdb 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/TargetResourceEndpointAccess.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Models/TargetResourceEndpointAccess.cs @@ -56,14 +56,16 @@ internal TargetResourceEndpointAccess() /// 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. /// Keeps track of any properties unknown to the library. - internal TargetResourceEndpointAccess(string namespaceName, string namespaceNameSuffix, string hybridConnectionName, string accessKey, long? expiresOn, IDictionary serializedAdditionalRawData) + internal TargetResourceEndpointAccess(string namespaceName, string namespaceNameSuffix, string hybridConnectionName, string accessKey, long? expiresOn, string serviceConfigurationToken, IDictionary serializedAdditionalRawData) { NamespaceName = namespaceName; NamespaceNameSuffix = namespaceNameSuffix; HybridConnectionName = hybridConnectionName; AccessKey = accessKey; ExpiresOn = expiresOn; + ServiceConfigurationToken = serviceConfigurationToken; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -77,5 +79,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/PublicCloudConnectorCollection.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/PublicCloudConnectorCollection.cs new file mode 100644 index 000000000000..847fc0c425a8 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/PublicCloudConnectorCollection.cs @@ -0,0 +1,494 @@ +// 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 Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +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 GetPublicCloudConnectors method from an instance of . + /// + public partial class PublicCloudConnectorCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _publicCloudConnectorClientDiagnostics; + private readonly PublicCloudConnectorsRestOperations _publicCloudConnectorRestClient; + + /// Initializes a new instance of the class for mocking. + protected PublicCloudConnectorCollection() + { + } + + /// 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 PublicCloudConnectorCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _publicCloudConnectorClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridConnectivity", PublicCloudConnectorResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(PublicCloudConnectorResource.ResourceType, out string publicCloudConnectorApiVersion); + _publicCloudConnectorRestClient = new PublicCloudConnectorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, publicCloudConnectorApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Create a PublicCloudConnector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// Represent public cloud connectors resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string publicCloudConnector, PublicCloudConnectorData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicCloudConnector, nameof(publicCloudConnector)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _publicCloudConnectorRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, publicCloudConnector, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridConnectivityArmOperation(new PublicCloudConnectorOperationSource(Client), _publicCloudConnectorClientDiagnostics, Pipeline, _publicCloudConnectorRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, publicCloudConnector, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a PublicCloudConnector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// Represent public cloud connectors resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string publicCloudConnector, PublicCloudConnectorData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicCloudConnector, nameof(publicCloudConnector)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _publicCloudConnectorRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, publicCloudConnector, data, cancellationToken); + var operation = new HybridConnectivityArmOperation(new PublicCloudConnectorOperationSource(Client), _publicCloudConnectorClientDiagnostics, Pipeline, _publicCloudConnectorRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, publicCloudConnector, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a PublicCloudConnector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Represent public cloud connectors resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string publicCloudConnector, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicCloudConnector, nameof(publicCloudConnector)); + + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorCollection.Get"); + scope.Start(); + try + { + var response = await _publicCloudConnectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, publicCloudConnector, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PublicCloudConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a PublicCloudConnector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Represent public cloud connectors resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string publicCloudConnector, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicCloudConnector, nameof(publicCloudConnector)); + + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorCollection.Get"); + scope.Start(); + try + { + var response = _publicCloudConnectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, publicCloudConnector, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PublicCloudConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List PublicCloudConnector resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors + /// + /// + /// Operation Id + /// PublicCloudConnectors_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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) => _publicCloudConnectorRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _publicCloudConnectorRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PublicCloudConnectorResource(Client, PublicCloudConnectorData.DeserializePublicCloudConnectorData(e)), _publicCloudConnectorClientDiagnostics, Pipeline, "PublicCloudConnectorCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List PublicCloudConnector resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors + /// + /// + /// Operation Id + /// PublicCloudConnectors_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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) => _publicCloudConnectorRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _publicCloudConnectorRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PublicCloudConnectorResource(Client, PublicCloudConnectorData.DeserializePublicCloudConnectorData(e)), _publicCloudConnectorClientDiagnostics, Pipeline, "PublicCloudConnectorCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Represent public cloud connectors resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string publicCloudConnector, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicCloudConnector, nameof(publicCloudConnector)); + + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorCollection.Exists"); + scope.Start(); + try + { + var response = await _publicCloudConnectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, publicCloudConnector, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Represent public cloud connectors resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string publicCloudConnector, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicCloudConnector, nameof(publicCloudConnector)); + + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorCollection.Exists"); + scope.Start(); + try + { + var response = _publicCloudConnectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, publicCloudConnector, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Represent public cloud connectors resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string publicCloudConnector, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicCloudConnector, nameof(publicCloudConnector)); + + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _publicCloudConnectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, publicCloudConnector, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PublicCloudConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Represent public cloud connectors resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string publicCloudConnector, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publicCloudConnector, nameof(publicCloudConnector)); + + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _publicCloudConnectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, publicCloudConnector, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PublicCloudConnectorResource(Client, response.Value), 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/PublicCloudConnectorData.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/PublicCloudConnectorData.Serialization.cs new file mode 100644 index 000000000000..75c7a2b7dad6 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/PublicCloudConnectorData.Serialization.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridConnectivity.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridConnectivity +{ + public partial class PublicCloudConnectorData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PublicCloudConnectorData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + PublicCloudConnectorData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PublicCloudConnectorData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePublicCloudConnectorData(document.RootElement, options); + } + + internal static PublicCloudConnectorData DeserializePublicCloudConnectorData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PublicCloudConnectorProperties properties = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = PublicCloudConnectorProperties.DeserializePublicCloudConnectorProperties(property.Value, options); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PublicCloudConnectorData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PublicCloudConnectorData)} does not support writing '{options.Format}' format."); + } + } + + PublicCloudConnectorData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePublicCloudConnectorData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PublicCloudConnectorData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/PublicCloudConnectorData.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/PublicCloudConnectorData.cs new file mode 100644 index 000000000000..81a1e382548e --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/PublicCloudConnectorData.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridConnectivity.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridConnectivity +{ + /// + /// A class representing the PublicCloudConnector data model. + /// Public Cloud Connector + /// + public partial class PublicCloudConnectorData : TrackedResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The location. + public PublicCloudConnectorData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal PublicCloudConnectorData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, PublicCloudConnectorProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PublicCloudConnectorData() + { + } + + /// The resource-specific properties for this resource. + public PublicCloudConnectorProperties Properties { get; set; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/PublicCloudConnectorResource.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/PublicCloudConnectorResource.Serialization.cs new file mode 100644 index 000000000000..d83b87210bb2 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/PublicCloudConnectorResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.HybridConnectivity +{ + public partial class PublicCloudConnectorResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + PublicCloudConnectorData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + PublicCloudConnectorData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/PublicCloudConnectorResource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/PublicCloudConnectorResource.cs new file mode 100644 index 000000000000..909bac2b9f24 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/PublicCloudConnectorResource.cs @@ -0,0 +1,787 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridConnectivity.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridConnectivity +{ + /// + /// A Class representing a PublicCloudConnector 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 GetPublicCloudConnectorResource method. + /// Otherwise you can get one from its parent resource using the GetPublicCloudConnector method. + /// + public partial class PublicCloudConnectorResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The publicCloudConnector. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publicCloudConnector) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _publicCloudConnectorClientDiagnostics; + private readonly PublicCloudConnectorsRestOperations _publicCloudConnectorRestClient; + private readonly PublicCloudConnectorData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridConnectivity/publicCloudConnectors"; + + /// Initializes a new instance of the class for mocking. + protected PublicCloudConnectorResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal PublicCloudConnectorResource(ArmClient client, PublicCloudConnectorData 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 PublicCloudConnectorResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _publicCloudConnectorClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridConnectivity", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string publicCloudConnectorApiVersion); + _publicCloudConnectorRestClient = new PublicCloudConnectorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, publicCloudConnectorApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// 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 PublicCloudConnectorData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a PublicCloudConnector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorResource.Get"); + scope.Start(); + try + { + var response = await _publicCloudConnectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PublicCloudConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a PublicCloudConnector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorResource.Get"); + scope.Start(); + try + { + var response = _publicCloudConnectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PublicCloudConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a PublicCloudConnector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Delete + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorResource.Delete"); + scope.Start(); + try + { + var response = await _publicCloudConnectorRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _publicCloudConnectorRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new HybridConnectivityArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a PublicCloudConnector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Delete + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorResource.Delete"); + scope.Start(); + try + { + var response = _publicCloudConnectorRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var uri = _publicCloudConnectorRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new HybridConnectivityArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a PublicCloudConnector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Update + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(PublicCloudConnectorPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorResource.Update"); + scope.Start(); + try + { + var response = await _publicCloudConnectorRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PublicCloudConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a PublicCloudConnector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Update + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual Response Update(PublicCloudConnectorPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorResource.Update"); + scope.Start(); + try + { + var response = _publicCloudConnectorRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + return Response.FromValue(new PublicCloudConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// A long-running resource action. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}/testPermissions + /// + /// + /// Operation Id + /// PublicCloudConnectors_TestPermissions + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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> TestPermissionsAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorResource.TestPermissions"); + scope.Start(); + try + { + var response = await _publicCloudConnectorRestClient.TestPermissionsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridConnectivityArmOperation(new OperationStatusResultOperationSource(), _publicCloudConnectorClientDiagnostics, Pipeline, _publicCloudConnectorRestClient.CreateTestPermissionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// A long-running resource action. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}/testPermissions + /// + /// + /// Operation Id + /// PublicCloudConnectors_TestPermissions + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 TestPermissions(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorResource.TestPermissions"); + scope.Start(); + try + { + var response = _publicCloudConnectorRestClient.TestPermissions(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new HybridConnectivityArmOperation(new OperationStatusResultOperationSource(), _publicCloudConnectorClientDiagnostics, Pipeline, _publicCloudConnectorRestClient.CreateTestPermissionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _publicCloudConnectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PublicCloudConnectorResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new PublicCloudConnectorPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _publicCloudConnectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new PublicCloudConnectorResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new PublicCloudConnectorPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _publicCloudConnectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PublicCloudConnectorResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new PublicCloudConnectorPatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _publicCloudConnectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new PublicCloudConnectorResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new PublicCloudConnectorPatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _publicCloudConnectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PublicCloudConnectorResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new PublicCloudConnectorPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector} + /// + /// + /// Operation Id + /// PublicCloudConnectors_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _publicCloudConnectorClientDiagnostics.CreateScope("PublicCloudConnectorResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _publicCloudConnectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new PublicCloudConnectorResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new PublicCloudConnectorPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} 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 f4ff712c4ebb..f88182a78d21 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/EndpointsRestOperations.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/EndpointsRestOperations.cs @@ -32,7 +32,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 ?? "2024-12-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -452,7 +452,7 @@ public Response Delete(string scope, string endpointName, CancellationToken canc } } - internal RequestUriBuilder CreateListCredentialsRequestUri(string scope, string endpointName, long? expiresin) + internal RequestUriBuilder CreateListCredentialsRequestUri(string scope, string endpointName, ListCredentialsContent content, long? expiresin) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -469,7 +469,7 @@ internal RequestUriBuilder CreateListCredentialsRequestUri(string scope, string return uri; } - 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; @@ -488,6 +488,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, ModelSerializationExtensions.WireOptions); + request.Content = content0; + } _userAgent.Apply(message); return message; } @@ -495,15 +502,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) { @@ -522,15 +530,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) { @@ -546,6 +555,201 @@ public Response ListCredentials(string scope, stri } } + internal RequestUriBuilder CreateListIngressGatewayCredentialsRequestUri(string scope, string endpointName, ListIngressGatewayCredentialsContent content, long? expiresin) + { + 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); + } + return uri; + } + + 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, ModelSerializationExtensions.WireOptions); + 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 RequestUriBuilder CreateListManagedProxyDetailsRequestUri(string scope, string endpointName, ManagedProxyContent content) + { + 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); + return uri; + } + + 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, ModelSerializationExtensions.WireOptions); + 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 RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string scope) { var uri = new RawRequestUriBuilder(); diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/GenerateAwsTemplateRestOperations.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/GenerateAwsTemplateRestOperations.cs new file mode 100644 index 000000000000..85e3182d6214 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/GenerateAwsTemplateRestOperations.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridConnectivity.Models; + +namespace Azure.ResourceManager.HybridConnectivity +{ + internal partial class GenerateAwsTemplateRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of GenerateAwsTemplateRestOperations. + /// 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 GenerateAwsTemplateRestOperations(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 ?? "2024-12-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreatePostRequestUri(string subscriptionId, GenerateAwsTemplateContent content) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/generateAwsTemplate", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreatePostRequest(string subscriptionId, GenerateAwsTemplateContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/generateAwsTemplate", 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, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Retrieve AWS Cloud Formation template. + /// The ID of the target subscription. The value must be an UUID. + /// ConnectorId and SolutionTypes and their properties to Generate AWS CFT Template. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> PostAsync(string subscriptionId, GenerateAwsTemplateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreatePostRequest(subscriptionId, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BinaryData value = default; + value = await BinaryData.FromStreamAsync(message.Response.ContentStream).ConfigureAwait(false); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Retrieve AWS Cloud Formation template. + /// The ID of the target subscription. The value must be an UUID. + /// ConnectorId and SolutionTypes and their properties to Generate AWS CFT Template. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response Post(string subscriptionId, GenerateAwsTemplateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreatePostRequest(subscriptionId, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BinaryData value = default; + value = BinaryData.FromStream(message.Response.ContentStream); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/InventoryRestOperations.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/InventoryRestOperations.cs new file mode 100644 index 000000000000..6b4fc1fe770d --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/InventoryRestOperations.cs @@ -0,0 +1,301 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridConnectivity.Models; + +namespace Azure.ResourceManager.HybridConnectivity +{ + internal partial class InventoryRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of InventoryRestOperations. + /// 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 InventoryRestOperations(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 ?? "2024-12-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListBySolutionConfigurationRequestUri(string resourceUri, string solutionConfiguration) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionConfigurations/", false); + uri.AppendPath(solutionConfiguration, true); + uri.AppendPath("/inventory", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySolutionConfigurationRequest(string resourceUri, string solutionConfiguration) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionConfigurations/", false); + uri.AppendPath(solutionConfiguration, true); + uri.AppendPath("/inventory", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List InventoryResource resources by SolutionConfiguration. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySolutionConfigurationAsync(string resourceUri, string solutionConfiguration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + + using var message = CreateListBySolutionConfigurationRequest(resourceUri, solutionConfiguration); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + InventoryResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InventoryResourceListResult.DeserializeInventoryResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List InventoryResource resources by SolutionConfiguration. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySolutionConfiguration(string resourceUri, string solutionConfiguration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + + using var message = CreateListBySolutionConfigurationRequest(resourceUri, solutionConfiguration); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InventoryResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InventoryResourceListResult.DeserializeInventoryResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string resourceUri, string solutionConfiguration, string inventoryId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionConfigurations/", false); + uri.AppendPath(solutionConfiguration, true); + uri.AppendPath("/inventory/", false); + uri.AppendPath(inventoryId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string resourceUri, string solutionConfiguration, string inventoryId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionConfigurations/", false); + uri.AppendPath(solutionConfiguration, true); + uri.AppendPath("/inventory/", false); + uri.AppendPath(inventoryId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a InventoryResource. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Represent Solution Configuration Resource. + /// Inventory resource. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string resourceUri, string solutionConfiguration, string inventoryId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + Argument.AssertNotNullOrEmpty(inventoryId, nameof(inventoryId)); + + using var message = CreateGetRequest(resourceUri, solutionConfiguration, inventoryId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + InventoryResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InventoryResourceData.DeserializeInventoryResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((InventoryResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a InventoryResource. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Represent Solution Configuration Resource. + /// Inventory resource. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Get(string resourceUri, string solutionConfiguration, string inventoryId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + Argument.AssertNotNullOrEmpty(inventoryId, nameof(inventoryId)); + + using var message = CreateGetRequest(resourceUri, solutionConfiguration, inventoryId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InventoryResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InventoryResourceData.DeserializeInventoryResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((InventoryResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySolutionConfigurationNextPageRequestUri(string nextLink, string resourceUri, string solutionConfiguration) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySolutionConfigurationNextPageRequest(string nextLink, string resourceUri, string solutionConfiguration) + { + 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; + } + + /// List InventoryResource resources by SolutionConfiguration. + /// The URL to the next page of results. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySolutionConfigurationNextPageAsync(string nextLink, string resourceUri, string solutionConfiguration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + + using var message = CreateListBySolutionConfigurationNextPageRequest(nextLink, resourceUri, solutionConfiguration); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + InventoryResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InventoryResourceListResult.DeserializeInventoryResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List InventoryResource resources by SolutionConfiguration. + /// The URL to the next page of results. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySolutionConfigurationNextPage(string nextLink, string resourceUri, string solutionConfiguration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + + using var message = CreateListBySolutionConfigurationNextPageRequest(nextLink, resourceUri, solutionConfiguration); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InventoryResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InventoryResourceListResult.DeserializeInventoryResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/PublicCloudConnectorsRestOperations.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/PublicCloudConnectorsRestOperations.cs new file mode 100644 index 000000000000..d71090263f17 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/PublicCloudConnectorsRestOperations.cs @@ -0,0 +1,817 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridConnectivity.Models; + +namespace Azure.ResourceManager.HybridConnectivity +{ + internal partial class PublicCloudConnectorsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of PublicCloudConnectorsRestOperations. + /// 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 PublicCloudConnectorsRestOperations(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 ?? "2024-12-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/publicCloudConnectors", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/publicCloudConnectors", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List PublicCloudConnector resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PublicCloudConnectorListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PublicCloudConnectorListResult.DeserializePublicCloudConnectorListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List PublicCloudConnector resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PublicCloudConnectorListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PublicCloudConnectorListResult.DeserializePublicCloudConnectorListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/publicCloudConnectors", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/publicCloudConnectors", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List PublicCloudConnector resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PublicCloudConnectorListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PublicCloudConnectorListResult.DeserializePublicCloudConnectorListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List PublicCloudConnector resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PublicCloudConnectorListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PublicCloudConnectorListResult.DeserializePublicCloudConnectorListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string publicCloudConnector) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/publicCloudConnectors/", false); + uri.AppendPath(publicCloudConnector, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string publicCloudConnector) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/publicCloudConnectors/", false); + uri.AppendPath(publicCloudConnector, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a PublicCloudConnector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Represent public cloud connectors resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string publicCloudConnector, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publicCloudConnector, nameof(publicCloudConnector)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publicCloudConnector); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PublicCloudConnectorData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PublicCloudConnectorData.DeserializePublicCloudConnectorData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PublicCloudConnectorData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a PublicCloudConnector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Represent public cloud connectors resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string publicCloudConnector, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publicCloudConnector, nameof(publicCloudConnector)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publicCloudConnector); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PublicCloudConnectorData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PublicCloudConnectorData.DeserializePublicCloudConnectorData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PublicCloudConnectorData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string publicCloudConnector, PublicCloudConnectorData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/publicCloudConnectors/", false); + uri.AppendPath(publicCloudConnector, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string publicCloudConnector, PublicCloudConnectorData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/publicCloudConnectors/", false); + uri.AppendPath(publicCloudConnector, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a PublicCloudConnector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Represent public cloud connectors resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string publicCloudConnector, PublicCloudConnectorData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publicCloudConnector, nameof(publicCloudConnector)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publicCloudConnector, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a PublicCloudConnector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Represent public cloud connectors resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string publicCloudConnector, PublicCloudConnectorData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publicCloudConnector, nameof(publicCloudConnector)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publicCloudConnector, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string publicCloudConnector, PublicCloudConnectorPatch patch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/publicCloudConnectors/", false); + uri.AppendPath(publicCloudConnector, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string publicCloudConnector, PublicCloudConnectorPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/publicCloudConnectors/", false); + uri.AppendPath(publicCloudConnector, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a PublicCloudConnector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Represent public cloud connectors resource. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string publicCloudConnector, PublicCloudConnectorPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publicCloudConnector, nameof(publicCloudConnector)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publicCloudConnector, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PublicCloudConnectorData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PublicCloudConnectorData.DeserializePublicCloudConnectorData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a PublicCloudConnector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Represent public cloud connectors resource. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string publicCloudConnector, PublicCloudConnectorPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publicCloudConnector, nameof(publicCloudConnector)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publicCloudConnector, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PublicCloudConnectorData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PublicCloudConnectorData.DeserializePublicCloudConnectorData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string publicCloudConnector) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/publicCloudConnectors/", false); + uri.AppendPath(publicCloudConnector, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string publicCloudConnector) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/publicCloudConnectors/", false); + uri.AppendPath(publicCloudConnector, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a PublicCloudConnector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Represent public cloud connectors resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string publicCloudConnector, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publicCloudConnector, nameof(publicCloudConnector)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publicCloudConnector); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a PublicCloudConnector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Represent public cloud connectors resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string publicCloudConnector, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publicCloudConnector, nameof(publicCloudConnector)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publicCloudConnector); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateTestPermissionsRequestUri(string subscriptionId, string resourceGroupName, string publicCloudConnector) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/publicCloudConnectors/", false); + uri.AppendPath(publicCloudConnector, true); + uri.AppendPath("/testPermissions", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateTestPermissionsRequest(string subscriptionId, string resourceGroupName, string publicCloudConnector) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/publicCloudConnectors/", false); + uri.AppendPath(publicCloudConnector, true); + uri.AppendPath("/testPermissions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// A long-running resource action. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Represent public cloud connectors resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task TestPermissionsAsync(string subscriptionId, string resourceGroupName, string publicCloudConnector, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publicCloudConnector, nameof(publicCloudConnector)); + + using var message = CreateTestPermissionsRequest(subscriptionId, resourceGroupName, publicCloudConnector); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// A long-running resource action. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Represent public cloud connectors resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response TestPermissions(string subscriptionId, string resourceGroupName, string publicCloudConnector, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publicCloudConnector, nameof(publicCloudConnector)); + + using var message = CreateTestPermissionsRequest(subscriptionId, resourceGroupName, publicCloudConnector); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + { + 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; + } + + /// List PublicCloudConnector resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PublicCloudConnectorListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PublicCloudConnectorListResult.DeserializePublicCloudConnectorListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List PublicCloudConnector resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PublicCloudConnectorListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PublicCloudConnectorListResult.DeserializePublicCloudConnectorListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + { + 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; + } + + /// List PublicCloudConnector resources by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PublicCloudConnectorListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PublicCloudConnectorListResult.DeserializePublicCloudConnectorListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List PublicCloudConnector resources by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PublicCloudConnectorListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PublicCloudConnectorListResult.DeserializePublicCloudConnectorListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} 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..40bac437d63e --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/ServiceConfigurationsRestOperations.cs @@ -0,0 +1,575 @@ +// 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.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 ?? "2024-12-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListByEndpointResourceRequestUri(string scope, string endpointName) + { + 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); + return uri; + } + + 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 RequestUriBuilder CreateGetRequestUri(string scope, string endpointName, string serviceConfigurationName) + { + 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); + return uri; + } + + 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 RequestUriBuilder CreateCreateOrupdateRequestUri(string scope, string endpointName, string serviceConfigurationName, ServiceConfigurationResourceData data) + { + 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); + return uri; + } + + 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, ModelSerializationExtensions.WireOptions); + 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 RequestUriBuilder CreateUpdateRequestUri(string scope, string endpointName, string serviceConfigurationName, ServiceConfigurationResourcePatch 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); + return uri; + } + + 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, ModelSerializationExtensions.WireOptions); + 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 RequestUriBuilder CreateDeleteRequestUri(string scope, string endpointName, string serviceConfigurationName) + { + 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); + return uri; + } + + 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 RequestUriBuilder CreateListByEndpointResourceNextPageRequestUri(string nextLink, string scope, string endpointName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + 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/RestOperations/SolutionConfigurationsRestOperations.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/SolutionConfigurationsRestOperations.cs new file mode 100644 index 000000000000..e84bc53bd5ba --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/SolutionConfigurationsRestOperations.cs @@ -0,0 +1,617 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridConnectivity.Models; + +namespace Azure.ResourceManager.HybridConnectivity +{ + internal partial class SolutionConfigurationsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SolutionConfigurationsRestOperations. + /// 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 SolutionConfigurationsRestOperations(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 ?? "2024-12-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string resourceUri) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string resourceUri) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List SolutionConfiguration resources by parent. + /// The fully qualified Azure Resource manager identifier of the resource. + /// The cancellation token to use. + /// is null. + public async Task> ListAsync(string resourceUri, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListRequest(resourceUri); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SolutionConfigurationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SolutionConfigurationListResult.DeserializeSolutionConfigurationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List SolutionConfiguration resources by parent. + /// The fully qualified Azure Resource manager identifier of the resource. + /// The cancellation token to use. + /// is null. + public Response List(string resourceUri, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListRequest(resourceUri); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SolutionConfigurationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SolutionConfigurationListResult.DeserializeSolutionConfigurationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string resourceUri, string solutionConfiguration) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionConfigurations/", false); + uri.AppendPath(solutionConfiguration, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string resourceUri, string solutionConfiguration) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionConfigurations/", false); + uri.AppendPath(solutionConfiguration, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a SolutionConfiguration. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string resourceUri, string solutionConfiguration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + + using var message = CreateGetRequest(resourceUri, solutionConfiguration); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SolutionConfigurationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SolutionConfigurationData.DeserializeSolutionConfigurationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SolutionConfigurationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a SolutionConfiguration. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response Get(string resourceUri, string solutionConfiguration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + + using var message = CreateGetRequest(resourceUri, solutionConfiguration); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SolutionConfigurationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SolutionConfigurationData.DeserializeSolutionConfigurationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SolutionConfigurationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string resourceUri, string solutionConfiguration, SolutionConfigurationData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionConfigurations/", false); + uri.AppendPath(solutionConfiguration, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceUri, string solutionConfiguration, SolutionConfigurationData 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(resourceUri, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionConfigurations/", false); + uri.AppendPath(solutionConfiguration, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a SolutionConfiguration. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Represent Solution Configuration Resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string resourceUri, string solutionConfiguration, SolutionConfigurationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(resourceUri, solutionConfiguration, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + SolutionConfigurationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SolutionConfigurationData.DeserializeSolutionConfigurationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a SolutionConfiguration. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Represent Solution Configuration Resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string resourceUri, string solutionConfiguration, SolutionConfigurationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(resourceUri, solutionConfiguration, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + SolutionConfigurationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SolutionConfigurationData.DeserializeSolutionConfigurationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string resourceUri, string solutionConfiguration, SolutionConfigurationPatch patch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionConfigurations/", false); + uri.AppendPath(solutionConfiguration, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string resourceUri, string solutionConfiguration, SolutionConfigurationPatch 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(resourceUri, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionConfigurations/", false); + uri.AppendPath(solutionConfiguration, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a SolutionConfiguration. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Represent Solution Configuration Resource. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string resourceUri, string solutionConfiguration, SolutionConfigurationPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(resourceUri, solutionConfiguration, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SolutionConfigurationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SolutionConfigurationData.DeserializeSolutionConfigurationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a SolutionConfiguration. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Represent Solution Configuration Resource. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public Response Update(string resourceUri, string solutionConfiguration, SolutionConfigurationPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(resourceUri, solutionConfiguration, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SolutionConfigurationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SolutionConfigurationData.DeserializeSolutionConfigurationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string resourceUri, string solutionConfiguration) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionConfigurations/", false); + uri.AppendPath(solutionConfiguration, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string resourceUri, string solutionConfiguration) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionConfigurations/", false); + uri.AppendPath(solutionConfiguration, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a SolutionConfiguration. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string resourceUri, string solutionConfiguration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + + using var message = CreateDeleteRequest(resourceUri, solutionConfiguration); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a SolutionConfiguration. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response Delete(string resourceUri, string solutionConfiguration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + + using var message = CreateDeleteRequest(resourceUri, solutionConfiguration); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateSyncNowRequestUri(string resourceUri, string solutionConfiguration) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionConfigurations/", false); + uri.AppendPath(solutionConfiguration, true); + uri.AppendPath("/syncNow", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateSyncNowRequest(string resourceUri, string solutionConfiguration) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionConfigurations/", false); + uri.AppendPath(solutionConfiguration, true); + uri.AppendPath("/syncNow", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Trigger immediate sync with source cloud. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task SyncNowAsync(string resourceUri, string solutionConfiguration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + + using var message = CreateSyncNowRequest(resourceUri, solutionConfiguration); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Trigger immediate sync with source cloud. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response SyncNow(string resourceUri, string solutionConfiguration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + + using var message = CreateSyncNowRequest(resourceUri, solutionConfiguration); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string resourceUri) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceUri) + { + 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; + } + + /// List SolutionConfiguration resources by parent. + /// The URL to the next page of results. + /// The fully qualified Azure Resource manager identifier of the resource. + /// The cancellation token to use. + /// or is null. + public async Task> ListNextPageAsync(string nextLink, string resourceUri, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListNextPageRequest(nextLink, resourceUri); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SolutionConfigurationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SolutionConfigurationListResult.DeserializeSolutionConfigurationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List SolutionConfiguration resources by parent. + /// The URL to the next page of results. + /// The fully qualified Azure Resource manager identifier of the resource. + /// The cancellation token to use. + /// or is null. + public Response ListNextPage(string nextLink, string resourceUri, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListNextPageRequest(nextLink, resourceUri); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SolutionConfigurationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SolutionConfigurationListResult.DeserializeSolutionConfigurationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/SolutionTypesRestOperations.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/SolutionTypesRestOperations.cs new file mode 100644 index 000000000000..67866a05c575 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/RestOperations/SolutionTypesRestOperations.cs @@ -0,0 +1,455 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridConnectivity.Models; + +namespace Azure.ResourceManager.HybridConnectivity +{ + internal partial class SolutionTypesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SolutionTypesRestOperations. + /// 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 SolutionTypesRestOperations(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 ?? "2024-12-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionTypes", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionTypes", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List SolutionTypeResource resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SolutionTypeResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SolutionTypeResourceListResult.DeserializeSolutionTypeResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List SolutionTypeResource resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SolutionTypeResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SolutionTypeResourceListResult.DeserializeSolutionTypeResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionTypes", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionTypes", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List SolutionTypeResource resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SolutionTypeResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SolutionTypeResourceListResult.DeserializeSolutionTypeResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List SolutionTypeResource resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SolutionTypeResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SolutionTypeResourceListResult.DeserializeSolutionTypeResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string solutionType) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionTypes/", false); + uri.AppendPath(solutionType, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string solutionType) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridConnectivity/solutionTypes/", false); + uri.AppendPath(solutionType, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a SolutionTypeResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Solution Type resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string solutionType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(solutionType, nameof(solutionType)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, solutionType); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SolutionTypeResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SolutionTypeResourceData.DeserializeSolutionTypeResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SolutionTypeResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a SolutionTypeResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Solution Type resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string solutionType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(solutionType, nameof(solutionType)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, solutionType); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SolutionTypeResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SolutionTypeResourceData.DeserializeSolutionTypeResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SolutionTypeResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + { + 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; + } + + /// List SolutionTypeResource resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SolutionTypeResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SolutionTypeResourceListResult.DeserializeSolutionTypeResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List SolutionTypeResource resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SolutionTypeResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SolutionTypeResourceListResult.DeserializeSolutionTypeResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + { + 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; + } + + /// List SolutionTypeResource resources by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SolutionTypeResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SolutionTypeResourceListResult.DeserializeSolutionTypeResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List SolutionTypeResource resources by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SolutionTypeResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SolutionTypeResourceListResult.DeserializeSolutionTypeResourceListResult(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.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ServiceConfigurationResource.Serialization.cs new file mode 100644 index 000000000000..bfe7319b039f --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ServiceConfigurationResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.HybridConnectivity +{ + public partial class ServiceConfigurationResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + ServiceConfigurationResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + ServiceConfigurationResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} 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..ffe2df2957c1 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ServiceConfigurationResource.cs @@ -0,0 +1,343 @@ +// 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.Core; +using Azure.Core.Pipeline; +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. + /// The scope. + /// The endpointName. + /// The serviceConfigurationName. + 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; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridConnectivity/endpoints/serviceConfigurations"; + + /// 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 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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _serviceConfigurationResourceServiceConfigurationsRestClient.CreateDeleteRequestUri(Id.Parent.Parent, Id.Parent.Name, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new HybridConnectivityArmOperation(response, rehydrationToken); + 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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _serviceConfigurationResourceServiceConfigurationsRestClient.CreateDeleteRequestUri(Id.Parent.Parent, Id.Parent.Name, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new HybridConnectivityArmOperation(response, rehydrationToken); + 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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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..97c227bf2990 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ServiceConfigurationResourceCollection.cs @@ -0,0 +1,489 @@ +// 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 Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _serviceConfigurationResourceServiceConfigurationsRestClient.CreateCreateOrupdateRequestUri(Id.Parent, Id.Name, serviceConfigurationName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new HybridConnectivityArmOperation(Response.FromValue(new ServiceConfigurationResource(Client, response), response.GetRawResponse()), rehydrationToken); + 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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _serviceConfigurationResourceServiceConfigurationsRestClient.CreateCreateOrupdateRequestUri(Id.Parent, Id.Name, serviceConfigurationName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new HybridConnectivityArmOperation(Response.FromValue(new ServiceConfigurationResource(Client, response), response.GetRawResponse()), rehydrationToken); + 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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 GeneratorPageableHelpers.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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 GeneratorPageableHelpers.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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName} + /// + /// + /// Operation Id + /// ServiceConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The service name. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetIfExistsAsync(string serviceConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(serviceConfigurationName, nameof(serviceConfigurationName)); + + using var scope = _serviceConfigurationResourceServiceConfigurationsClientDiagnostics.CreateScope("ServiceConfigurationResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _serviceConfigurationResourceServiceConfigurationsRestClient.GetAsync(Id.Parent, Id.Name, serviceConfigurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/serviceConfigurations/{serviceConfigurationName} + /// + /// + /// Operation Id + /// ServiceConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The service name. + /// The cancellation token to use. + /// is null. + public virtual NullableResponse GetIfExists(string serviceConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(serviceConfigurationName, nameof(serviceConfigurationName)); + + using var scope = _serviceConfigurationResourceServiceConfigurationsClientDiagnostics.CreateScope("ServiceConfigurationResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _serviceConfigurationResourceServiceConfigurationsRestClient.Get(Id.Parent, Id.Name, serviceConfigurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ServiceConfigurationResource(Client, response.Value), 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.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ServiceConfigurationResourceData.Serialization.cs new file mode 100644 index 000000000000..1cba2ad4f598 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ServiceConfigurationResourceData.Serialization.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +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, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ServiceConfigurationResourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + 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); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + writer.WriteEndObject(); + } + + ServiceConfigurationResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ServiceConfigurationResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeServiceConfigurationResourceData(document.RootElement, options); + } + + internal static ServiceConfigurationResourceData DeserializeServiceConfigurationResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + ServiceName? serviceName = default; + string resourceId = default; + long? port = default; + ProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ServiceConfigurationResourceData( + id, + name, + type, + systemData, + serviceName, + resourceId, + port, + provisioningState, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ServiceConfigurationResourceData)} does not support writing '{options.Format}' format."); + } + } + + ServiceConfigurationResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeServiceConfigurationResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ServiceConfigurationResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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..04b3654aa625 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/ServiceConfigurationResourceData.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +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 + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ServiceConfigurationResourceData() + { + } + + /// Initializes a new instance of . + /// 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. + /// Keeps track of any properties unknown to the library. + internal ServiceConfigurationResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ServiceName? serviceName, string resourceId, long? port, ProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + ServiceName = serviceName; + ResourceId = resourceId; + Port = port; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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/Generated/SolutionConfigurationCollection.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionConfigurationCollection.cs new file mode 100644 index 000000000000..87102d9f86d7 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionConfigurationCollection.cs @@ -0,0 +1,487 @@ +// 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.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +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 GetSolutionConfigurations method from an instance of . + /// + public partial class SolutionConfigurationCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _solutionConfigurationClientDiagnostics; + private readonly SolutionConfigurationsRestOperations _solutionConfigurationRestClient; + + /// Initializes a new instance of the class for mocking. + protected SolutionConfigurationCollection() + { + } + + /// 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 SolutionConfigurationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _solutionConfigurationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridConnectivity", SolutionConfigurationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SolutionConfigurationResource.ResourceType, out string solutionConfigurationApiVersion); + _solutionConfigurationRestClient = new SolutionConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, solutionConfigurationApiVersion); + } + + /// + /// Create a SolutionConfiguration + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration} + /// + /// + /// Operation Id + /// SolutionConfigurations_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// Represent Solution Configuration Resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string solutionConfiguration, SolutionConfigurationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _solutionConfigurationClientDiagnostics.CreateScope("SolutionConfigurationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _solutionConfigurationRestClient.CreateOrUpdateAsync(Id, solutionConfiguration, data, cancellationToken).ConfigureAwait(false); + var uri = _solutionConfigurationRestClient.CreateCreateOrUpdateRequestUri(Id, solutionConfiguration, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new HybridConnectivityArmOperation(Response.FromValue(new SolutionConfigurationResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a SolutionConfiguration + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration} + /// + /// + /// Operation Id + /// SolutionConfigurations_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// Represent Solution Configuration Resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string solutionConfiguration, SolutionConfigurationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _solutionConfigurationClientDiagnostics.CreateScope("SolutionConfigurationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _solutionConfigurationRestClient.CreateOrUpdate(Id, solutionConfiguration, data, cancellationToken); + var uri = _solutionConfigurationRestClient.CreateCreateOrUpdateRequestUri(Id, solutionConfiguration, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new HybridConnectivityArmOperation(Response.FromValue(new SolutionConfigurationResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SolutionConfiguration + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration} + /// + /// + /// Operation Id + /// SolutionConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string solutionConfiguration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + + using var scope = _solutionConfigurationClientDiagnostics.CreateScope("SolutionConfigurationCollection.Get"); + scope.Start(); + try + { + var response = await _solutionConfigurationRestClient.GetAsync(Id, solutionConfiguration, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SolutionConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SolutionConfiguration + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration} + /// + /// + /// Operation Id + /// SolutionConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string solutionConfiguration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + + using var scope = _solutionConfigurationClientDiagnostics.CreateScope("SolutionConfigurationCollection.Get"); + scope.Start(); + try + { + var response = _solutionConfigurationRestClient.Get(Id, solutionConfiguration, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SolutionConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List SolutionConfiguration resources by parent + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations + /// + /// + /// Operation Id + /// SolutionConfigurations_List + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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) => _solutionConfigurationRestClient.CreateListRequest(Id); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _solutionConfigurationRestClient.CreateListNextPageRequest(nextLink, Id); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SolutionConfigurationResource(Client, SolutionConfigurationData.DeserializeSolutionConfigurationData(e)), _solutionConfigurationClientDiagnostics, Pipeline, "SolutionConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List SolutionConfiguration resources by parent + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations + /// + /// + /// Operation Id + /// SolutionConfigurations_List + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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) => _solutionConfigurationRestClient.CreateListRequest(Id); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _solutionConfigurationRestClient.CreateListNextPageRequest(nextLink, Id); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SolutionConfigurationResource(Client, SolutionConfigurationData.DeserializeSolutionConfigurationData(e)), _solutionConfigurationClientDiagnostics, Pipeline, "SolutionConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration} + /// + /// + /// Operation Id + /// SolutionConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string solutionConfiguration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + + using var scope = _solutionConfigurationClientDiagnostics.CreateScope("SolutionConfigurationCollection.Exists"); + scope.Start(); + try + { + var response = await _solutionConfigurationRestClient.GetAsync(Id, solutionConfiguration, 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/solutionConfigurations/{solutionConfiguration} + /// + /// + /// Operation Id + /// SolutionConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string solutionConfiguration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + + using var scope = _solutionConfigurationClientDiagnostics.CreateScope("SolutionConfigurationCollection.Exists"); + scope.Start(); + try + { + var response = _solutionConfigurationRestClient.Get(Id, solutionConfiguration, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration} + /// + /// + /// Operation Id + /// SolutionConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string solutionConfiguration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + + using var scope = _solutionConfigurationClientDiagnostics.CreateScope("SolutionConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _solutionConfigurationRestClient.GetAsync(Id, solutionConfiguration, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SolutionConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration} + /// + /// + /// Operation Id + /// SolutionConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Represent Solution Configuration Resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string solutionConfiguration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionConfiguration, nameof(solutionConfiguration)); + + using var scope = _solutionConfigurationClientDiagnostics.CreateScope("SolutionConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _solutionConfigurationRestClient.Get(Id, solutionConfiguration, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SolutionConfigurationResource(Client, response.Value), 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/SolutionConfigurationData.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionConfigurationData.Serialization.cs new file mode 100644 index 000000000000..195e3264d933 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionConfigurationData.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridConnectivity.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridConnectivity +{ + public partial class SolutionConfigurationData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionConfigurationData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + SolutionConfigurationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionConfigurationData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSolutionConfigurationData(document.RootElement, options); + } + + internal static SolutionConfigurationData DeserializeSolutionConfigurationData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SolutionConfigurationProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SolutionConfigurationProperties.DeserializeSolutionConfigurationProperties(property.Value, options); + continue; + } + 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SolutionConfigurationData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SolutionConfigurationData)} does not support writing '{options.Format}' format."); + } + } + + SolutionConfigurationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSolutionConfigurationData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SolutionConfigurationData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionConfigurationData.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionConfigurationData.cs new file mode 100644 index 000000000000..ade9a60f10f9 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionConfigurationData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridConnectivity.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridConnectivity +{ + /// + /// A class representing the SolutionConfiguration data model. + /// Solution Configuration + /// + public partial class SolutionConfigurationData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SolutionConfigurationData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal SolutionConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SolutionConfigurationProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public SolutionConfigurationProperties Properties { get; set; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionConfigurationResource.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionConfigurationResource.Serialization.cs new file mode 100644 index 000000000000..18c0a804a078 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionConfigurationResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.HybridConnectivity +{ + public partial class SolutionConfigurationResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + SolutionConfigurationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + SolutionConfigurationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionConfigurationResource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionConfigurationResource.cs new file mode 100644 index 000000000000..32622a0c2b9c --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionConfigurationResource.cs @@ -0,0 +1,495 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.HybridConnectivity.Models; + +namespace Azure.ResourceManager.HybridConnectivity +{ + /// + /// A Class representing a SolutionConfiguration 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 GetSolutionConfigurationResource method. + /// Otherwise you can get one from its parent resource using the GetSolutionConfiguration method. + /// + public partial class SolutionConfigurationResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The resourceUri. + /// The solutionConfiguration. + public static ResourceIdentifier CreateResourceIdentifier(string resourceUri, string solutionConfiguration) + { + var resourceId = $"{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _solutionConfigurationClientDiagnostics; + private readonly SolutionConfigurationsRestOperations _solutionConfigurationRestClient; + private readonly SolutionConfigurationData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridConnectivity/solutionConfigurations"; + + /// Initializes a new instance of the class for mocking. + protected SolutionConfigurationResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SolutionConfigurationResource(ArmClient client, SolutionConfigurationData 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 SolutionConfigurationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _solutionConfigurationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridConnectivity", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string solutionConfigurationApiVersion); + _solutionConfigurationRestClient = new SolutionConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, solutionConfigurationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// 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 SolutionConfigurationData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of InventoryResources in the SolutionConfiguration. + /// An object representing collection of InventoryResources and their operations over a InventoryResource. + public virtual InventoryResourceCollection GetInventoryResources() + { + return GetCachedClient(client => new InventoryResourceCollection(client, Id)); + } + + /// + /// Get a InventoryResource + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory/{inventoryId} + /// + /// + /// Operation Id + /// Inventory_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Inventory resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetInventoryResourceAsync(string inventoryId, CancellationToken cancellationToken = default) + { + return await GetInventoryResources().GetAsync(inventoryId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a InventoryResource + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/inventory/{inventoryId} + /// + /// + /// Operation Id + /// Inventory_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Inventory resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetInventoryResource(string inventoryId, CancellationToken cancellationToken = default) + { + return GetInventoryResources().Get(inventoryId, cancellationToken); + } + + /// + /// Get a SolutionConfiguration + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration} + /// + /// + /// Operation Id + /// SolutionConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _solutionConfigurationClientDiagnostics.CreateScope("SolutionConfigurationResource.Get"); + scope.Start(); + try + { + var response = await _solutionConfigurationRestClient.GetAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SolutionConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SolutionConfiguration + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration} + /// + /// + /// Operation Id + /// SolutionConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _solutionConfigurationClientDiagnostics.CreateScope("SolutionConfigurationResource.Get"); + scope.Start(); + try + { + var response = _solutionConfigurationRestClient.Get(Id.Parent, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SolutionConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a SolutionConfiguration + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration} + /// + /// + /// Operation Id + /// SolutionConfigurations_Delete + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 = _solutionConfigurationClientDiagnostics.CreateScope("SolutionConfigurationResource.Delete"); + scope.Start(); + try + { + var response = await _solutionConfigurationRestClient.DeleteAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _solutionConfigurationRestClient.CreateDeleteRequestUri(Id.Parent, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new HybridConnectivityArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a SolutionConfiguration + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration} + /// + /// + /// Operation Id + /// SolutionConfigurations_Delete + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 = _solutionConfigurationClientDiagnostics.CreateScope("SolutionConfigurationResource.Delete"); + scope.Start(); + try + { + var response = _solutionConfigurationRestClient.Delete(Id.Parent, Id.Name, cancellationToken); + var uri = _solutionConfigurationRestClient.CreateDeleteRequestUri(Id.Parent, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new HybridConnectivityArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a SolutionConfiguration + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration} + /// + /// + /// Operation Id + /// SolutionConfigurations_Update + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(SolutionConfigurationPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _solutionConfigurationClientDiagnostics.CreateScope("SolutionConfigurationResource.Update"); + scope.Start(); + try + { + var response = await _solutionConfigurationRestClient.UpdateAsync(Id.Parent, Id.Name, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SolutionConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a SolutionConfiguration + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration} + /// + /// + /// Operation Id + /// SolutionConfigurations_Update + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual Response Update(SolutionConfigurationPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _solutionConfigurationClientDiagnostics.CreateScope("SolutionConfigurationResource.Update"); + scope.Start(); + try + { + var response = _solutionConfigurationRestClient.Update(Id.Parent, Id.Name, patch, cancellationToken); + return Response.FromValue(new SolutionConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Trigger immediate sync with source cloud + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/syncNow + /// + /// + /// Operation Id + /// SolutionConfigurations_SyncNow + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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> SyncNowAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _solutionConfigurationClientDiagnostics.CreateScope("SolutionConfigurationResource.SyncNow"); + scope.Start(); + try + { + var response = await _solutionConfigurationRestClient.SyncNowAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridConnectivityArmOperation(new OperationStatusResultOperationSource(), _solutionConfigurationClientDiagnostics, Pipeline, _solutionConfigurationRestClient.CreateSyncNowRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Trigger immediate sync with source cloud + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}/syncNow + /// + /// + /// Operation Id + /// SolutionConfigurations_SyncNow + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 SyncNow(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _solutionConfigurationClientDiagnostics.CreateScope("SolutionConfigurationResource.SyncNow"); + scope.Start(); + try + { + var response = _solutionConfigurationRestClient.SyncNow(Id.Parent, Id.Name, cancellationToken); + var operation = new HybridConnectivityArmOperation(new OperationStatusResultOperationSource(), _solutionConfigurationClientDiagnostics, Pipeline, _solutionConfigurationRestClient.CreateSyncNowRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionTypeResource.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionTypeResource.Serialization.cs new file mode 100644 index 000000000000..59b64769dc79 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionTypeResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.HybridConnectivity +{ + public partial class SolutionTypeResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + SolutionTypeResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + SolutionTypeResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionTypeResource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionTypeResource.cs new file mode 100644 index 000000000000..9c458c5c7528 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionTypeResource.cs @@ -0,0 +1,171 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridConnectivity +{ + /// + /// A Class representing a SolutionTypeResource 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 GetSolutionTypeResource method. + /// Otherwise you can get one from its parent resource using the GetSolutionTypeResource method. + /// + public partial class SolutionTypeResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The solutionType. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string solutionType) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes/{solutionType}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _solutionTypeResourceSolutionTypesClientDiagnostics; + private readonly SolutionTypesRestOperations _solutionTypeResourceSolutionTypesRestClient; + private readonly SolutionTypeResourceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridConnectivity/solutionTypes"; + + /// Initializes a new instance of the class for mocking. + protected SolutionTypeResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SolutionTypeResource(ArmClient client, SolutionTypeResourceData 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 SolutionTypeResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _solutionTypeResourceSolutionTypesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridConnectivity", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string solutionTypeResourceSolutionTypesApiVersion); + _solutionTypeResourceSolutionTypesRestClient = new SolutionTypesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, solutionTypeResourceSolutionTypesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// 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 SolutionTypeResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a SolutionTypeResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes/{solutionType} + /// + /// + /// Operation Id + /// SolutionTypes_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _solutionTypeResourceSolutionTypesClientDiagnostics.CreateScope("SolutionTypeResource.Get"); + scope.Start(); + try + { + var response = await _solutionTypeResourceSolutionTypesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SolutionTypeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SolutionTypeResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes/{solutionType} + /// + /// + /// Operation Id + /// SolutionTypes_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _solutionTypeResourceSolutionTypesClientDiagnostics.CreateScope("SolutionTypeResource.Get"); + scope.Start(); + try + { + var response = _solutionTypeResourceSolutionTypesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SolutionTypeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionTypeResourceCollection.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionTypeResourceCollection.cs new file mode 100644 index 000000000000..7d3003ed9ebc --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionTypeResourceCollection.cs @@ -0,0 +1,396 @@ +// 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 Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +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 GetSolutionTypeResources method from an instance of . + /// + public partial class SolutionTypeResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _solutionTypeResourceSolutionTypesClientDiagnostics; + private readonly SolutionTypesRestOperations _solutionTypeResourceSolutionTypesRestClient; + + /// Initializes a new instance of the class for mocking. + protected SolutionTypeResourceCollection() + { + } + + /// 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 SolutionTypeResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _solutionTypeResourceSolutionTypesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridConnectivity", SolutionTypeResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SolutionTypeResource.ResourceType, out string solutionTypeResourceSolutionTypesApiVersion); + _solutionTypeResourceSolutionTypesRestClient = new SolutionTypesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, solutionTypeResourceSolutionTypesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Get a SolutionTypeResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes/{solutionType} + /// + /// + /// Operation Id + /// SolutionTypes_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Solution Type resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string solutionType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionType, nameof(solutionType)); + + using var scope = _solutionTypeResourceSolutionTypesClientDiagnostics.CreateScope("SolutionTypeResourceCollection.Get"); + scope.Start(); + try + { + var response = await _solutionTypeResourceSolutionTypesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, solutionType, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SolutionTypeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SolutionTypeResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes/{solutionType} + /// + /// + /// Operation Id + /// SolutionTypes_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Solution Type resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string solutionType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionType, nameof(solutionType)); + + using var scope = _solutionTypeResourceSolutionTypesClientDiagnostics.CreateScope("SolutionTypeResourceCollection.Get"); + scope.Start(); + try + { + var response = _solutionTypeResourceSolutionTypesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, solutionType, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SolutionTypeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List SolutionTypeResource resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes + /// + /// + /// Operation Id + /// SolutionTypes_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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) => _solutionTypeResourceSolutionTypesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _solutionTypeResourceSolutionTypesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SolutionTypeResource(Client, SolutionTypeResourceData.DeserializeSolutionTypeResourceData(e)), _solutionTypeResourceSolutionTypesClientDiagnostics, Pipeline, "SolutionTypeResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List SolutionTypeResource resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes + /// + /// + /// Operation Id + /// SolutionTypes_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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) => _solutionTypeResourceSolutionTypesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _solutionTypeResourceSolutionTypesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SolutionTypeResource(Client, SolutionTypeResourceData.DeserializeSolutionTypeResourceData(e)), _solutionTypeResourceSolutionTypesClientDiagnostics, Pipeline, "SolutionTypeResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes/{solutionType} + /// + /// + /// Operation Id + /// SolutionTypes_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Solution Type resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string solutionType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionType, nameof(solutionType)); + + using var scope = _solutionTypeResourceSolutionTypesClientDiagnostics.CreateScope("SolutionTypeResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _solutionTypeResourceSolutionTypesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, solutionType, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes/{solutionType} + /// + /// + /// Operation Id + /// SolutionTypes_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Solution Type resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string solutionType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionType, nameof(solutionType)); + + using var scope = _solutionTypeResourceSolutionTypesClientDiagnostics.CreateScope("SolutionTypeResourceCollection.Exists"); + scope.Start(); + try + { + var response = _solutionTypeResourceSolutionTypesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, solutionType, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes/{solutionType} + /// + /// + /// Operation Id + /// SolutionTypes_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Solution Type resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string solutionType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionType, nameof(solutionType)); + + using var scope = _solutionTypeResourceSolutionTypesClientDiagnostics.CreateScope("SolutionTypeResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _solutionTypeResourceSolutionTypesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, solutionType, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SolutionTypeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/solutionTypes/{solutionType} + /// + /// + /// Operation Id + /// SolutionTypes_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Solution Type resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string solutionType, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionType, nameof(solutionType)); + + using var scope = _solutionTypeResourceSolutionTypesClientDiagnostics.CreateScope("SolutionTypeResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _solutionTypeResourceSolutionTypesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, solutionType, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SolutionTypeResource(Client, response.Value), 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/SolutionTypeResourceData.Serialization.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionTypeResourceData.Serialization.cs new file mode 100644 index 000000000000..1d9efc8d3384 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionTypeResourceData.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridConnectivity.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridConnectivity +{ + public partial class SolutionTypeResourceData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionTypeResourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + SolutionTypeResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SolutionTypeResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSolutionTypeResourceData(document.RootElement, options); + } + + internal static SolutionTypeResourceData DeserializeSolutionTypeResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SolutionTypeProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SolutionTypeProperties.DeserializeSolutionTypeProperties(property.Value, options); + continue; + } + 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SolutionTypeResourceData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SolutionTypeResourceData)} does not support writing '{options.Format}' format."); + } + } + + SolutionTypeResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSolutionTypeResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SolutionTypeResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionTypeResourceData.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionTypeResourceData.cs new file mode 100644 index 000000000000..5318ae08d4da --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/SolutionTypeResourceData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridConnectivity.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridConnectivity +{ + /// + /// A class representing the SolutionTypeResource data model. + /// Concrete proxy resource types can be created by aliasing this type using a specific property type. + /// + public partial class SolutionTypeResourceData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SolutionTypeResourceData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal SolutionTypeResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SolutionTypeProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public SolutionTypeProperties Properties { get; set; } + } +} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/autorest.md b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/autorest.md index 330b8518a357..83c6e4f2ce3f 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 sample-gen: