diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/api/Azure.ResourceManager.ServiceLinker.netstandard2.0.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/api/Azure.ResourceManager.ServiceLinker.netstandard2.0.cs index ef9e62807832..329b3bbcf52a 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/api/Azure.ResourceManager.ServiceLinker.netstandard2.0.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/api/Azure.ResourceManager.ServiceLinker.netstandard2.0.cs @@ -1,26 +1,45 @@ namespace Azure.ResourceManager.ServiceLinker { - public partial class LinkerResource : Azure.ResourceManager.ArmResource + public partial class DryrunCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DryrunCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string dryrunName, Azure.ResourceManager.ServiceLinker.DryrunResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string dryrunName, Azure.ResourceManager.ServiceLinker.DryrunResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string dryrunName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string dryrunName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string dryrunName, 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 dryrunName, 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 DryrunResource : Azure.ResourceManager.ArmResource { public static readonly Azure.Core.ResourceType ResourceType; - protected LinkerResource() { } - public virtual Azure.ResourceManager.ServiceLinker.LinkerResourceData Data { get { throw null; } } + protected DryrunResource() { } + public virtual Azure.ResourceManager.ServiceLinker.DryrunResourceData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } - public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string resourceUri, string linkerName) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string resourceUri, string dryrunName) { 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 GetConfigurations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetConfigurationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.ServiceLinker.Models.LinkerResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ServiceLinker.Models.LinkerResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.ArmOperation Validate(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ValidateAsync(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.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.ServiceLinker.Models.DryrunPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ServiceLinker.Models.DryrunPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class LinkerResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + public partial class DryrunResourceData : Azure.ResourceManager.Models.ResourceData { - protected LinkerResourceCollection() { } + public DryrunResourceData() { } + public System.Collections.Generic.IReadOnlyList OperationPreviews { get { throw null; } } + public Azure.ResourceManager.ServiceLinker.Models.DryrunParameters Parameters { get { throw null; } set { } } + public System.Collections.Generic.IReadOnlyList PrerequisiteResults { get { throw null; } } + public string ProvisioningState { get { throw null; } } + } + public partial class LinkerCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected LinkerCollection() { } public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string linkerName, Azure.ResourceManager.ServiceLinker.LinkerResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string linkerName, Azure.ResourceManager.ServiceLinker.LinkerResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Exists(string linkerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -33,30 +52,191 @@ protected LinkerResourceCollection() { } System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } } + public partial class LinkerResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected LinkerResource() { } + public virtual Azure.ResourceManager.ServiceLinker.LinkerResourceData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string resourceUri, string linkerName) { 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 GenerateConfigurations(Azure.ResourceManager.ServiceLinker.Models.ConfigurationInfo info = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GenerateConfigurationsAsync(Azure.ResourceManager.ServiceLinker.Models.ConfigurationInfo info = null, 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 GetConfigurations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetConfigurationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.ServiceLinker.Models.LinkerPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ServiceLinker.Models.LinkerPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Validate(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ValidateAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } public partial class LinkerResourceData : Azure.ResourceManager.Models.ResourceData { public LinkerResourceData() { } public Azure.ResourceManager.ServiceLinker.Models.AuthBaseInfo AuthInfo { get { throw null; } set { } } public Azure.ResourceManager.ServiceLinker.Models.LinkerClientType? ClientType { get { throw null; } set { } } + public Azure.ResourceManager.ServiceLinker.Models.ConfigurationInfo ConfigurationInfo { get { throw null; } set { } } public string ProvisioningState { get { throw null; } } + public Azure.ResourceManager.ServiceLinker.Models.PublicNetworkSolution PublicNetworkSolution { get { throw null; } set { } } public string Scope { get { throw null; } set { } } - public Azure.Core.ResourceIdentifier SecretStoreKeyVaultId { get { throw null; } set { } } - public Azure.ResourceManager.ServiceLinker.Models.VnetSolutionType? SolutionType { get { throw null; } set { } } + public Azure.ResourceManager.ServiceLinker.Models.LinkerSecretStore SecretStore { get { throw null; } set { } } public Azure.ResourceManager.ServiceLinker.Models.TargetServiceBaseInfo TargetService { get { throw null; } set { } } + public Azure.ResourceManager.ServiceLinker.Models.VnetSolution VnetSolution { get { throw null; } set { } } + } + public partial class LocationConnectorCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected LocationConnectorCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string connectorName, Azure.ResourceManager.ServiceLinker.LinkerResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string connectorName, Azure.ResourceManager.ServiceLinker.LinkerResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string connectorName, 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 connectorName, 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 LocationConnectorResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected LocationConnectorResource() { } + public virtual Azure.ResourceManager.ServiceLinker.LinkerResourceData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, Azure.Core.AzureLocation location, string connectorName) { 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 GenerateConfigurations(Azure.ResourceManager.ServiceLinker.Models.ConfigurationInfo info = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GenerateConfigurationsAsync(Azure.ResourceManager.ServiceLinker.Models.ConfigurationInfo info = null, 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.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.ServiceLinker.Models.LinkerPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ServiceLinker.Models.LinkerPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Validate(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ValidateAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class LocationDryrunCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected LocationDryrunCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string dryrunName, Azure.ResourceManager.ServiceLinker.DryrunResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string dryrunName, Azure.ResourceManager.ServiceLinker.DryrunResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string dryrunName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string dryrunName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string dryrunName, 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 dryrunName, 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 LocationDryrunResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected LocationDryrunResource() { } + public virtual Azure.ResourceManager.ServiceLinker.DryrunResourceData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, Azure.Core.AzureLocation location, string dryrunName) { 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.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.ServiceLinker.Models.DryrunPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ServiceLinker.Models.DryrunPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public static partial class ServiceLinkerExtensions { + public static Azure.Pageable GetConfigurationNames(this Azure.ResourceManager.Resources.TenantResource tenantResource, string filter = null, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetConfigurationNamesAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, string filter = null, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetDryrun(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string dryrunName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDryrunAsync(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string dryrunName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.ServiceLinker.DryrunResource GetDryrunResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.ServiceLinker.DryrunCollection GetDryruns(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope) { throw null; } + public static Azure.Response GetLinker(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string linkerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetLinker(this Azure.ResourceManager.ArmResource armResource, string linkerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetLinkerAsync(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string linkerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetLinkerAsync(this Azure.ResourceManager.ArmResource armResource, string linkerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.ServiceLinker.LinkerResource GetLinkerResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } - public static Azure.Response GetLinkerResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string linkerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Response GetLinkerResource(this Azure.ResourceManager.ArmResource armResource, string linkerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task> GetLinkerResourceAsync(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string linkerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task> GetLinkerResourceAsync(this Azure.ResourceManager.ArmResource armResource, string linkerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.ResourceManager.ServiceLinker.LinkerResourceCollection GetLinkerResources(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope) { throw null; } - public static Azure.ResourceManager.ServiceLinker.LinkerResourceCollection GetLinkerResources(this Azure.ResourceManager.ArmResource armResource) { throw null; } + public static Azure.ResourceManager.ServiceLinker.LinkerCollection GetLinkers(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope) { throw null; } + public static Azure.ResourceManager.ServiceLinker.LinkerCollection GetLinkers(this Azure.ResourceManager.ArmResource armResource) { throw null; } + public static Azure.Response GetLocationConnector(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.Core.AzureLocation location, string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetLocationConnectorAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.Core.AzureLocation location, string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.ServiceLinker.LocationConnectorResource GetLocationConnectorResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.ServiceLinker.LocationConnectorCollection GetLocationConnectors(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.Core.AzureLocation location) { throw null; } + public static Azure.Response GetLocationDryrun(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.Core.AzureLocation location, string dryrunName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetLocationDryrunAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.Core.AzureLocation location, string dryrunName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.ServiceLinker.LocationDryrunResource GetLocationDryrunResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.ServiceLinker.LocationDryrunCollection GetLocationDryruns(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.Core.AzureLocation location) { throw null; } } } namespace Azure.ResourceManager.ServiceLinker.Models { + public partial class AccessKeyInfoBase : Azure.ResourceManager.ServiceLinker.Models.AuthBaseInfo + { + public AccessKeyInfoBase() { } + public System.Collections.Generic.IList Permissions { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AccessKeyPermission : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AccessKeyPermission(string value) { throw null; } + public static Azure.ResourceManager.ServiceLinker.Models.AccessKeyPermission Listen { get { throw null; } } + public static Azure.ResourceManager.ServiceLinker.Models.AccessKeyPermission Manage { get { throw null; } } + public static Azure.ResourceManager.ServiceLinker.Models.AccessKeyPermission Read { get { throw null; } } + public static Azure.ResourceManager.ServiceLinker.Models.AccessKeyPermission Send { get { throw null; } } + public static Azure.ResourceManager.ServiceLinker.Models.AccessKeyPermission Write { get { throw null; } } + public bool Equals(Azure.ResourceManager.ServiceLinker.Models.AccessKeyPermission 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.ServiceLinker.Models.AccessKeyPermission left, Azure.ResourceManager.ServiceLinker.Models.AccessKeyPermission right) { throw null; } + public static implicit operator Azure.ResourceManager.ServiceLinker.Models.AccessKeyPermission (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ServiceLinker.Models.AccessKeyPermission left, Azure.ResourceManager.ServiceLinker.Models.AccessKeyPermission right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ActionType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ActionType(string value) { throw null; } + public static Azure.ResourceManager.ServiceLinker.Models.ActionType Enable { get { throw null; } } + public static Azure.ResourceManager.ServiceLinker.Models.ActionType Internal { get { throw null; } } + public static Azure.ResourceManager.ServiceLinker.Models.ActionType OptOut { get { throw null; } } + public bool Equals(Azure.ResourceManager.ServiceLinker.Models.ActionType 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.ServiceLinker.Models.ActionType left, Azure.ResourceManager.ServiceLinker.Models.ActionType right) { throw null; } + public static implicit operator Azure.ResourceManager.ServiceLinker.Models.ActionType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ServiceLinker.Models.ActionType left, Azure.ResourceManager.ServiceLinker.Models.ActionType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AllowType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AllowType(string value) { throw null; } + public static Azure.ResourceManager.ServiceLinker.Models.AllowType False { get { throw null; } } + public static Azure.ResourceManager.ServiceLinker.Models.AllowType True { get { throw null; } } + public bool Equals(Azure.ResourceManager.ServiceLinker.Models.AllowType 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.ServiceLinker.Models.AllowType left, Azure.ResourceManager.ServiceLinker.Models.AllowType right) { throw null; } + public static implicit operator Azure.ResourceManager.ServiceLinker.Models.AllowType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ServiceLinker.Models.AllowType left, Azure.ResourceManager.ServiceLinker.Models.AllowType right) { throw null; } + public override string ToString() { throw null; } + } public abstract partial class AuthBaseInfo { protected AuthBaseInfo() { } @@ -76,6 +256,39 @@ public AzureResourceInfo() { } public Azure.Core.ResourceIdentifier Id { get { throw null; } set { } } public Azure.ResourceManager.ServiceLinker.Models.AzureResourceBaseProperties ResourceProperties { get { throw null; } set { } } } + public partial class BasicErrorDryrunPrerequisiteResult : Azure.ResourceManager.ServiceLinker.Models.DryrunPrerequisiteResult + { + internal BasicErrorDryrunPrerequisiteResult() { } + public string Code { get { throw null; } } + public string Message { get { throw null; } } + } + public partial class ConfigurationInfo + { + public ConfigurationInfo() { } + public Azure.ResourceManager.ServiceLinker.Models.ActionType? Action { get { throw null; } set { } } + public System.Collections.Generic.IDictionary AdditionalConfigurations { get { throw null; } } + public System.Collections.Generic.IDictionary CustomizedKeys { get { throw null; } } + public Azure.ResourceManager.ServiceLinker.Models.DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get { throw null; } set { } } + } + public partial class ConfigurationName + { + internal ConfigurationName() { } + public string Description { get { throw null; } } + public string Value { get { throw null; } } + } + public partial class ConfigurationNameItem + { + internal ConfigurationNameItem() { } + public Azure.ResourceManager.ServiceLinker.Models.LinkerAuthType? AuthType { get { throw null; } } + public Azure.ResourceManager.ServiceLinker.Models.LinkerClientType? ClientType { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Names { get { throw null; } } + public string TargetService { get { throw null; } } + } + public partial class ConfigurationResult + { + internal ConfigurationResult() { } + public System.Collections.Generic.IReadOnlyList Configurations { get { throw null; } } + } public partial class ConfluentBootstrapServerInfo : Azure.ResourceManager.ServiceLinker.Models.TargetServiceBaseInfo { public ConfluentBootstrapServerInfo() { } @@ -86,6 +299,88 @@ public partial class ConfluentSchemaRegistryInfo : Azure.ResourceManager.Service public ConfluentSchemaRegistryInfo() { } public string Endpoint { get { throw null; } set { } } } + public partial class CreateOrUpdateDryrunParameters : Azure.ResourceManager.ServiceLinker.Models.DryrunParameters + { + public CreateOrUpdateDryrunParameters() { } + public Azure.ResourceManager.ServiceLinker.Models.AuthBaseInfo AuthInfo { get { throw null; } set { } } + public Azure.ResourceManager.ServiceLinker.Models.LinkerClientType? ClientType { get { throw null; } set { } } + public Azure.ResourceManager.ServiceLinker.Models.ConfigurationInfo ConfigurationInfo { get { throw null; } set { } } + public string ProvisioningState { get { throw null; } } + public Azure.ResourceManager.ServiceLinker.Models.PublicNetworkSolution PublicNetworkSolution { get { throw null; } set { } } + public string Scope { get { throw null; } set { } } + public Azure.ResourceManager.ServiceLinker.Models.LinkerSecretStore SecretStore { get { throw null; } set { } } + public Azure.ResourceManager.ServiceLinker.Models.TargetServiceBaseInfo TargetService { get { throw null; } set { } } + public Azure.ResourceManager.ServiceLinker.Models.VnetSolution VnetSolution { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DeleteOrUpdateBehavior : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DeleteOrUpdateBehavior(string value) { throw null; } + public static Azure.ResourceManager.ServiceLinker.Models.DeleteOrUpdateBehavior Default { get { throw null; } } + public static Azure.ResourceManager.ServiceLinker.Models.DeleteOrUpdateBehavior ForcedCleanup { get { throw null; } } + public bool Equals(Azure.ResourceManager.ServiceLinker.Models.DeleteOrUpdateBehavior 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.ServiceLinker.Models.DeleteOrUpdateBehavior left, Azure.ResourceManager.ServiceLinker.Models.DeleteOrUpdateBehavior right) { throw null; } + public static implicit operator Azure.ResourceManager.ServiceLinker.Models.DeleteOrUpdateBehavior (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ServiceLinker.Models.DeleteOrUpdateBehavior left, Azure.ResourceManager.ServiceLinker.Models.DeleteOrUpdateBehavior right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DryrunOperationPreview + { + internal DryrunOperationPreview() { } + public string Action { get { throw null; } } + public string Description { get { throw null; } } + public string Name { get { throw null; } } + public Azure.ResourceManager.ServiceLinker.Models.DryrunPreviewOperationType? OperationType { get { throw null; } } + public string Scope { get { throw null; } } + } + public abstract partial class DryrunParameters + { + protected DryrunParameters() { } + } + public partial class DryrunPatch + { + public DryrunPatch() { } + public System.Collections.Generic.IReadOnlyList OperationPreviews { get { throw null; } } + public Azure.ResourceManager.ServiceLinker.Models.DryrunParameters Parameters { get { throw null; } set { } } + public System.Collections.Generic.IReadOnlyList PrerequisiteResults { get { throw null; } } + public string ProvisioningState { get { throw null; } } + } + public abstract partial class DryrunPrerequisiteResult + { + protected DryrunPrerequisiteResult() { } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DryrunPreviewOperationType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DryrunPreviewOperationType(string value) { throw null; } + public static Azure.ResourceManager.ServiceLinker.Models.DryrunPreviewOperationType ConfigAuth { get { throw null; } } + public static Azure.ResourceManager.ServiceLinker.Models.DryrunPreviewOperationType ConfigConnection { get { throw null; } } + public static Azure.ResourceManager.ServiceLinker.Models.DryrunPreviewOperationType ConfigNetwork { get { throw null; } } + public bool Equals(Azure.ResourceManager.ServiceLinker.Models.DryrunPreviewOperationType 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.ServiceLinker.Models.DryrunPreviewOperationType left, Azure.ResourceManager.ServiceLinker.Models.DryrunPreviewOperationType right) { throw null; } + public static implicit operator Azure.ResourceManager.ServiceLinker.Models.DryrunPreviewOperationType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ServiceLinker.Models.DryrunPreviewOperationType left, Azure.ResourceManager.ServiceLinker.Models.DryrunPreviewOperationType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class FirewallRules + { + public FirewallRules() { } + public Azure.ResourceManager.ServiceLinker.Models.AllowType? AzureServices { get { throw null; } set { } } + public Azure.ResourceManager.ServiceLinker.Models.AllowType? CallerClientIP { get { throw null; } set { } } + public System.Collections.Generic.IList IPRanges { get { throw null; } } + } public partial class KeyVaultSecretReferenceSecretInfo : Azure.ResourceManager.ServiceLinker.Models.SecretBaseInfo { public KeyVaultSecretReferenceSecretInfo() { } @@ -103,10 +398,12 @@ public KeyVaultSecretUriSecretInfo() { } private readonly object _dummy; private readonly int _dummyPrimitive; public LinkerAuthType(string value) { throw null; } + public static Azure.ResourceManager.ServiceLinker.Models.LinkerAuthType AccessKey { get { throw null; } } public static Azure.ResourceManager.ServiceLinker.Models.LinkerAuthType Secret { get { throw null; } } public static Azure.ResourceManager.ServiceLinker.Models.LinkerAuthType ServicePrincipalCertificate { get { throw null; } } public static Azure.ResourceManager.ServiceLinker.Models.LinkerAuthType ServicePrincipalSecret { get { throw null; } } public static Azure.ResourceManager.ServiceLinker.Models.LinkerAuthType SystemAssignedIdentity { get { throw null; } } + public static Azure.ResourceManager.ServiceLinker.Models.LinkerAuthType UserAccount { get { throw null; } } public static Azure.ResourceManager.ServiceLinker.Models.LinkerAuthType UserAssignedIdentity { get { throw null; } } public bool Equals(Azure.ResourceManager.ServiceLinker.Models.LinkerAuthType other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -128,6 +425,7 @@ public KeyVaultSecretUriSecretInfo() { } public static Azure.ResourceManager.ServiceLinker.Models.LinkerClientType Dotnet { get { throw null; } } public static Azure.ResourceManager.ServiceLinker.Models.LinkerClientType Go { get { throw null; } } public static Azure.ResourceManager.ServiceLinker.Models.LinkerClientType Java { get { throw null; } } + public static Azure.ResourceManager.ServiceLinker.Models.LinkerClientType KafkaSpringBoot { get { throw null; } } public static Azure.ResourceManager.ServiceLinker.Models.LinkerClientType Nodejs { get { throw null; } } public static Azure.ResourceManager.ServiceLinker.Models.LinkerClientType None { get { throw null; } } public static Azure.ResourceManager.ServiceLinker.Models.LinkerClientType Php { get { throw null; } } @@ -144,16 +442,24 @@ public KeyVaultSecretUriSecretInfo() { } public static bool operator !=(Azure.ResourceManager.ServiceLinker.Models.LinkerClientType left, Azure.ResourceManager.ServiceLinker.Models.LinkerClientType right) { throw null; } public override string ToString() { throw null; } } - public partial class LinkerResourcePatch + public partial class LinkerPatch { - public LinkerResourcePatch() { } + public LinkerPatch() { } public Azure.ResourceManager.ServiceLinker.Models.AuthBaseInfo AuthInfo { get { throw null; } set { } } public Azure.ResourceManager.ServiceLinker.Models.LinkerClientType? ClientType { get { throw null; } set { } } + public Azure.ResourceManager.ServiceLinker.Models.ConfigurationInfo ConfigurationInfo { get { throw null; } set { } } public string ProvisioningState { get { throw null; } } + public Azure.ResourceManager.ServiceLinker.Models.PublicNetworkSolution PublicNetworkSolution { get { throw null; } set { } } public string Scope { get { throw null; } set { } } - public Azure.Core.ResourceIdentifier SecretStoreKeyVaultId { get { throw null; } set { } } - public Azure.ResourceManager.ServiceLinker.Models.VnetSolutionType? SolutionType { get { throw null; } set { } } + public Azure.ResourceManager.ServiceLinker.Models.LinkerSecretStore SecretStore { get { throw null; } set { } } public Azure.ResourceManager.ServiceLinker.Models.TargetServiceBaseInfo TargetService { get { throw null; } set { } } + public Azure.ResourceManager.ServiceLinker.Models.VnetSolution VnetSolution { get { throw null; } set { } } + } + public partial class LinkerSecretStore + { + public LinkerSecretStore() { } + public Azure.Core.ResourceIdentifier KeyVaultId { get { throw null; } set { } } + public string KeyVaultSecretName { get { throw null; } set { } } } public partial class LinkerValidateOperationResult { @@ -197,6 +503,20 @@ internal LinkerValidationResultItemInfo() { } public static bool operator !=(Azure.ResourceManager.ServiceLinker.Models.LinkerValidationResultStatus left, Azure.ResourceManager.ServiceLinker.Models.LinkerValidationResultStatus right) { throw null; } public override string ToString() { throw null; } } + public partial class PermissionsMissingDryrunPrerequisiteResult : Azure.ResourceManager.ServiceLinker.Models.DryrunPrerequisiteResult + { + internal PermissionsMissingDryrunPrerequisiteResult() { } + public System.Collections.Generic.IReadOnlyList Permissions { get { throw null; } } + public string RecommendedRole { get { throw null; } } + public string Scope { get { throw null; } } + } + public partial class PublicNetworkSolution + { + public PublicNetworkSolution() { } + public Azure.ResourceManager.ServiceLinker.Models.ActionType? Action { get { throw null; } set { } } + public Azure.ResourceManager.ServiceLinker.Models.DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get { throw null; } set { } } + public Azure.ResourceManager.ServiceLinker.Models.FirewallRules FirewallRules { get { throw null; } set { } } + } public partial class RawValueSecretInfo : Azure.ResourceManager.ServiceLinker.Models.SecretBaseInfo { public RawValueSecretInfo() { } @@ -212,19 +532,29 @@ public abstract partial class SecretBaseInfo { protected SecretBaseInfo() { } } + public partial class SelfHostedServer : Azure.ResourceManager.ServiceLinker.Models.TargetServiceBaseInfo + { + public SelfHostedServer() { } + public string Endpoint { get { throw null; } set { } } + } public partial class ServicePrincipalCertificateAuthInfo : Azure.ResourceManager.ServiceLinker.Models.AuthBaseInfo { public ServicePrincipalCertificateAuthInfo(string clientId, System.Guid principalId, string certificate) { } public string Certificate { get { throw null; } set { } } public string ClientId { get { throw null; } set { } } + public Azure.ResourceManager.ServiceLinker.Models.DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get { throw null; } set { } } public System.Guid PrincipalId { get { throw null; } set { } } + public System.Collections.Generic.IList Roles { get { throw null; } } } public partial class ServicePrincipalSecretAuthInfo : Azure.ResourceManager.ServiceLinker.Models.AuthBaseInfo { public ServicePrincipalSecretAuthInfo(string clientId, System.Guid principalId, string secret) { } public string ClientId { get { throw null; } set { } } + public Azure.ResourceManager.ServiceLinker.Models.DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get { throw null; } set { } } public System.Guid PrincipalId { get { throw null; } set { } } + public System.Collections.Generic.IList Roles { get { throw null; } } public string Secret { get { throw null; } set { } } + public string UserName { get { throw null; } set { } } } public partial class SourceConfiguration { @@ -232,24 +562,39 @@ internal SourceConfiguration() { } public string Name { get { throw null; } } public string Value { get { throw null; } } } - public partial class SourceConfigurationResult - { - internal SourceConfigurationResult() { } - public System.Collections.Generic.IReadOnlyList Configurations { get { throw null; } } - } public partial class SystemAssignedIdentityAuthInfo : Azure.ResourceManager.ServiceLinker.Models.AuthBaseInfo { public SystemAssignedIdentityAuthInfo() { } + public Azure.ResourceManager.ServiceLinker.Models.DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get { throw null; } set { } } + public System.Collections.Generic.IList Roles { get { throw null; } } + public string UserName { get { throw null; } set { } } } public abstract partial class TargetServiceBaseInfo { protected TargetServiceBaseInfo() { } } + public partial class UserAccountAuthInfo : Azure.ResourceManager.ServiceLinker.Models.AuthBaseInfo + { + public UserAccountAuthInfo() { } + public Azure.ResourceManager.ServiceLinker.Models.DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get { throw null; } set { } } + public System.Guid? PrincipalId { get { throw null; } set { } } + public System.Collections.Generic.IList Roles { get { throw null; } } + public string UserName { get { throw null; } set { } } + } public partial class UserAssignedIdentityAuthInfo : Azure.ResourceManager.ServiceLinker.Models.AuthBaseInfo { public UserAssignedIdentityAuthInfo() { } public string ClientId { get { throw null; } set { } } + public Azure.ResourceManager.ServiceLinker.Models.DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get { throw null; } set { } } + public System.Collections.Generic.IList Roles { get { throw null; } } public string SubscriptionId { get { throw null; } set { } } + public string UserName { get { throw null; } set { } } + } + public partial class VnetSolution + { + public VnetSolution() { } + public Azure.ResourceManager.ServiceLinker.Models.DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get { throw null; } set { } } + public Azure.ResourceManager.ServiceLinker.Models.VnetSolutionType? SolutionType { get { throw null; } set { } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct VnetSolutionType : System.IEquatable diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunCollection.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunCollection.cs new file mode 100644 index 000000000000..2c28157aead0 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunCollection.cs @@ -0,0 +1,323 @@ +// 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.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ServiceLinker +{ + /// + /// 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 GetDryruns method from an instance of . + /// + public partial class DryrunCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dryrunLinkersClientDiagnostics; + private readonly LinkersRestOperations _dryrunLinkersRestClient; + + /// Initializes a new instance of the class for mocking. + protected DryrunCollection() + { + } + + /// 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 DryrunCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dryrunLinkersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", DryrunResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DryrunResource.ResourceType, out string dryrunLinkersApiVersion); + _dryrunLinkersRestClient = new LinkersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dryrunLinkersApiVersion); + } + + /// + /// create a dryrun job to do necessary check before actual creation + /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// Operation Id: Linkers_CreateDryrun + /// + /// 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 name of dryrun. + /// dryrun resource. + /// 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 dryrunName, DryrunResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dryrunLinkersRestClient.CreateDryrunAsync(Id, dryrunName, data, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new DryrunOperationSource(Client), _dryrunLinkersClientDiagnostics, Pipeline, _dryrunLinkersRestClient.CreateCreateDryrunRequest(Id, dryrunName, 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 dryrun job to do necessary check before actual creation + /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// Operation Id: Linkers_CreateDryrun + /// + /// 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 name of dryrun. + /// dryrun resource. + /// 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 dryrunName, DryrunResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dryrunLinkersRestClient.CreateDryrun(Id, dryrunName, data, cancellationToken); + var operation = new ServiceLinkerArmOperation(new DryrunOperationSource(Client), _dryrunLinkersClientDiagnostics, Pipeline, _dryrunLinkersRestClient.CreateCreateDryrunRequest(Id, dryrunName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// get a dryrun job + /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// Operation Id: Linkers_GetDryrun + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunCollection.Get"); + scope.Start(); + try + { + var response = await _dryrunLinkersRestClient.GetDryrunAsync(Id, dryrunName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// get a dryrun job + /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// Operation Id: Linkers_GetDryrun + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunCollection.Get"); + scope.Start(); + try + { + var response = _dryrunLinkersRestClient.GetDryrun(Id, dryrunName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// list dryrun jobs + /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns + /// Operation Id: Linkers_ListDryrun + /// + /// 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) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunCollection.GetAll"); + scope.Start(); + try + { + var response = await _dryrunLinkersRestClient.ListDryrunAsync(Id, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new DryrunResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunCollection.GetAll"); + scope.Start(); + try + { + var response = await _dryrunLinkersRestClient.ListDryrunNextPageAsync(nextLink, Id, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new DryrunResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// list dryrun jobs + /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns + /// Operation Id: Linkers_ListDryrun + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunCollection.GetAll"); + scope.Start(); + try + { + var response = _dryrunLinkersRestClient.ListDryrun(Id, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new DryrunResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunCollection.GetAll"); + scope.Start(); + try + { + var response = _dryrunLinkersRestClient.ListDryrunNextPage(nextLink, Id, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new DryrunResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Checks to see if the resource exists in azure. + /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// Operation Id: Linkers_GetDryrun + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunCollection.Exists"); + scope.Start(); + try + { + var response = await _dryrunLinkersRestClient.GetDryrunAsync(Id, dryrunName, 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.ServiceLinker/dryruns/{dryrunName} + /// Operation Id: Linkers_GetDryrun + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunCollection.Exists"); + scope.Start(); + try + { + var response = _dryrunLinkersRestClient.GetDryrun(Id, dryrunName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResource.cs new file mode 100644 index 000000000000..169eac7b3fb7 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResource.cs @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker +{ + /// + /// A Class representing a Dryrun 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 GetDryrunResource method. + /// Otherwise you can get one from its parent resource using the GetDryrun method. + /// + public partial class DryrunResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string resourceUri, string dryrunName) + { + var resourceId = $"{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dryrunLinkersClientDiagnostics; + private readonly LinkersRestOperations _dryrunLinkersRestClient; + private readonly DryrunResourceData _data; + + /// Initializes a new instance of the class for mocking. + protected DryrunResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DryrunResource(ArmClient client, DryrunResourceData 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 DryrunResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dryrunLinkersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dryrunLinkersApiVersion); + _dryrunLinkersRestClient = new LinkersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dryrunLinkersApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ServiceLinker/dryruns"; + + /// 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 DryrunResourceData 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 dryrun job + /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// Operation Id: Linkers_GetDryrun + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunResource.Get"); + scope.Start(); + try + { + var response = await _dryrunLinkersRestClient.GetDryrunAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// get a dryrun job + /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// Operation Id: Linkers_GetDryrun + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunResource.Get"); + scope.Start(); + try + { + var response = _dryrunLinkersRestClient.GetDryrun(Id.Parent, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// delete a dryrun job + /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// Operation Id: Linkers_DeleteDryrun + /// + /// 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 = _dryrunLinkersClientDiagnostics.CreateScope("DryrunResource.Delete"); + scope.Start(); + try + { + var response = await _dryrunLinkersRestClient.DeleteDryrunAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// delete a dryrun job + /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// Operation Id: Linkers_DeleteDryrun + /// + /// 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 = _dryrunLinkersClientDiagnostics.CreateScope("DryrunResource.Delete"); + scope.Start(); + try + { + var response = _dryrunLinkersRestClient.DeleteDryrun(Id.Parent, Id.Name, cancellationToken); + var operation = new ServiceLinkerArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// add a dryrun job to do necessary check before actual creation + /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// Operation Id: Linkers_UpdateDryrun + /// + /// 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. + /// dryrun resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DryrunPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunResource.Update"); + scope.Start(); + try + { + var response = await _dryrunLinkersRestClient.UpdateDryrunAsync(Id.Parent, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new DryrunOperationSource(Client), _dryrunLinkersClientDiagnostics, Pipeline, _dryrunLinkersRestClient.CreateUpdateDryrunRequest(Id.Parent, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// add a dryrun job to do necessary check before actual creation + /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// Operation Id: Linkers_UpdateDryrun + /// + /// 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. + /// dryrun resource. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DryrunPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunResource.Update"); + scope.Start(); + try + { + var response = _dryrunLinkersRestClient.UpdateDryrun(Id.Parent, Id.Name, patch, cancellationToken); + var operation = new ServiceLinkerArmOperation(new DryrunOperationSource(Client), _dryrunLinkersClientDiagnostics, Pipeline, _dryrunLinkersRestClient.CreateUpdateDryrunRequest(Id.Parent, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResourceData.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResourceData.cs new file mode 100644 index 000000000000..7f47ad4bce36 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResourceData.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker +{ + /// A class representing the DryrunResource data model. + public partial class DryrunResourceData : ResourceData + { + /// Initializes a new instance of DryrunResourceData. + public DryrunResourceData() + { + PrerequisiteResults = new ChangeTrackingList(); + OperationPreviews = new ChangeTrackingList(); + } + + /// Initializes a new instance of DryrunResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// + /// The parameters of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// + /// the result of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// the preview of the operations for creation. + /// The provisioning state. + internal DryrunResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DryrunParameters parameters, IReadOnlyList prerequisiteResults, IReadOnlyList operationPreviews, string provisioningState) : base(id, name, resourceType, systemData) + { + Parameters = parameters; + PrerequisiteResults = prerequisiteResults; + OperationPreviews = operationPreviews; + ProvisioningState = provisioningState; + } + + /// + /// The parameters of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public DryrunParameters Parameters { get; set; } + /// + /// the result of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public IReadOnlyList PrerequisiteResults { get; } + /// the preview of the operations for creation. + public IReadOnlyList OperationPreviews { get; } + /// The provisioning state. + public string ProvisioningState { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ArmResourceExtensionClient.cs index 940967455699..2e05775e8a77 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ArmResourceExtensionClient.cs @@ -31,11 +31,18 @@ private string GetApiVersionOrNull(ResourceType resourceType) return apiVersion; } + /// Gets a collection of DryrunResources in the ArmResource. + /// An object representing collection of DryrunResources and their operations over a DryrunResource. + public virtual DryrunCollection GetDryruns() + { + return GetCachedClient(Client => new DryrunCollection(Client, Id)); + } + /// Gets a collection of LinkerResources in the ArmResource. /// An object representing collection of LinkerResources and their operations over a LinkerResource. - public virtual LinkerResourceCollection GetLinkerResources() + public virtual LinkerCollection GetLinkers() { - return GetCachedClient(Client => new LinkerResourceCollection(Client, Id)); + return GetCachedClient(Client => new LinkerCollection(Client, Id)); } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs new file mode 100644 index 000000000000..8c6ea93a29bc --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ServiceLinker +{ + /// A class to add extension methods to ResourceGroupResource. + internal partial class ResourceGroupResourceExtensionClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected ResourceGroupResourceExtensionClient() + { + } + + /// 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 ResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of LocationDryrunResources in the ResourceGroupResource. + /// The name of Azure region. + /// An object representing collection of LocationDryrunResources and their operations over a LocationDryrunResource. + public virtual LocationDryrunCollection GetLocationDryruns(AzureLocation location) + { + return new LocationDryrunCollection(Client, Id, location); + } + + /// Gets a collection of LocationConnectorResources in the ResourceGroupResource. + /// The name of Azure region. + /// An object representing collection of LocationConnectorResources and their operations over a LocationConnectorResource. + public virtual LocationConnectorCollection GetLocationConnectors(AzureLocation location) + { + return new LocationConnectorCollection(Client, Id, location); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ServiceLinkerExtensions.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ServiceLinkerExtensions.cs index 6c8a0e78d835..45dac5b644a9 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ServiceLinkerExtensions.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ServiceLinkerExtensions.cs @@ -11,12 +11,148 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.ServiceLinker.Models; namespace Azure.ResourceManager.ServiceLinker { /// A class to add extension methods to Azure.ResourceManager.ServiceLinker. public static partial class ServiceLinkerExtensions { + private static TenantResourceExtensionClient GetExtensionClient(TenantResource tenantResource) + { + return tenantResource.GetCachedClient((client) => + { + return new TenantResourceExtensionClient(client, tenantResource.Id); + } + ); + } + + /// + /// Lists the configuration names generated by Service Connector for all target, client types, auth types. + /// Request Path: /providers/Microsoft.ServiceLinker/configurationNames + /// Operation Id: ConfigurationNames_List + /// + /// The instance the method will execute against. + /// OData filter options. + /// OData skipToken option for pagination. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetConfigurationNamesAsync(this TenantResource tenantResource, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + return GetExtensionClient(tenantResource).GetConfigurationNamesAsync(filter, skipToken, cancellationToken); + } + + /// + /// Lists the configuration names generated by Service Connector for all target, client types, auth types. + /// Request Path: /providers/Microsoft.ServiceLinker/configurationNames + /// Operation Id: ConfigurationNames_List + /// + /// The instance the method will execute against. + /// OData filter options. + /// OData skipToken option for pagination. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetConfigurationNames(this TenantResource tenantResource, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + return GetExtensionClient(tenantResource).GetConfigurationNames(filter, skipToken, cancellationToken); + } + + private static ResourceGroupResourceExtensionClient GetExtensionClient(ResourceGroupResource resourceGroupResource) + { + return resourceGroupResource.GetCachedClient((client) => + { + return new ResourceGroupResourceExtensionClient(client, resourceGroupResource.Id); + } + ); + } + + /// Gets a collection of LocationDryrunResources in the ResourceGroupResource. + /// The instance the method will execute against. + /// The name of Azure region. + /// An object representing collection of LocationDryrunResources and their operations over a LocationDryrunResource. + public static LocationDryrunCollection GetLocationDryruns(this ResourceGroupResource resourceGroupResource, AzureLocation location) + { + return GetExtensionClient(resourceGroupResource).GetLocationDryruns(location); + } + + /// + /// get a dryrun job + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// Operation Id: Connector_GetDryrun + /// + /// The instance the method will execute against. + /// The name of Azure region. + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetLocationDryrunAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, string dryrunName, CancellationToken cancellationToken = default) + { + return await resourceGroupResource.GetLocationDryruns(location).GetAsync(dryrunName, cancellationToken).ConfigureAwait(false); + } + + /// + /// get a dryrun job + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// Operation Id: Connector_GetDryrun + /// + /// The instance the method will execute against. + /// The name of Azure region. + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetLocationDryrun(this ResourceGroupResource resourceGroupResource, AzureLocation location, string dryrunName, CancellationToken cancellationToken = default) + { + return resourceGroupResource.GetLocationDryruns(location).Get(dryrunName, cancellationToken); + } + + /// Gets a collection of LocationConnectorResources in the ResourceGroupResource. + /// The instance the method will execute against. + /// The name of Azure region. + /// An object representing collection of LocationConnectorResources and their operations over a LocationConnectorResource. + public static LocationConnectorCollection GetLocationConnectors(this ResourceGroupResource resourceGroupResource, AzureLocation location) + { + return GetExtensionClient(resourceGroupResource).GetLocationConnectors(location); + } + + /// + /// Returns Connector resource for a given name. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// Operation Id: Connector_Get + /// + /// The instance the method will execute against. + /// The name of Azure region. + /// The name of resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetLocationConnectorAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, string connectorName, CancellationToken cancellationToken = default) + { + return await resourceGroupResource.GetLocationConnectors(location).GetAsync(connectorName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns Connector resource for a given name. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// Operation Id: Connector_Get + /// + /// The instance the method will execute against. + /// The name of Azure region. + /// The name of resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetLocationConnector(this ResourceGroupResource resourceGroupResource, AzureLocation location, string connectorName, CancellationToken cancellationToken = default) + { + return resourceGroupResource.GetLocationConnectors(location).Get(connectorName, cancellationToken); + } + private static ArmResourceExtensionClient GetExtensionClient(ArmClient client, ResourceIdentifier scope) { return client.GetResourceClient(() => @@ -35,21 +171,64 @@ private static ArmResourceExtensionClient GetExtensionClient(ArmResource armReso ); } + /// Gets a collection of DryrunResources in the ArmResource. + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// An object representing collection of DryrunResources and their operations over a DryrunResource. + public static DryrunCollection GetDryruns(this ArmClient client, ResourceIdentifier scope) + { + return GetExtensionClient(client, scope).GetDryruns(); + } + + /// + /// get a dryrun job + /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// Operation Id: Linkers_GetDryrun + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetDryrunAsync(this ArmClient client, ResourceIdentifier scope, string dryrunName, CancellationToken cancellationToken = default) + { + return await client.GetDryruns(scope).GetAsync(dryrunName, cancellationToken).ConfigureAwait(false); + } + + /// + /// get a dryrun job + /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// Operation Id: Linkers_GetDryrun + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetDryrun(this ArmClient client, ResourceIdentifier scope, string dryrunName, CancellationToken cancellationToken = default) + { + return client.GetDryruns(scope).Get(dryrunName, cancellationToken); + } + /// Gets a collection of LinkerResources in the ArmResource. /// The instance the method will execute against. /// An object representing collection of LinkerResources and their operations over a LinkerResource. - public static LinkerResourceCollection GetLinkerResources(this ArmResource armResource) + public static LinkerCollection GetLinkers(this ArmResource armResource) { - return GetExtensionClient(armResource).GetLinkerResources(); + return GetExtensionClient(armResource).GetLinkers(); } /// Gets a collection of LinkerResources in the ArmResource. /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of LinkerResources and their operations over a LinkerResource. - public static LinkerResourceCollection GetLinkerResources(this ArmClient client, ResourceIdentifier scope) + public static LinkerCollection GetLinkers(this ArmClient client, ResourceIdentifier scope) { - return GetExtensionClient(client, scope).GetLinkerResources(); + return GetExtensionClient(client, scope).GetLinkers(); } /// @@ -63,9 +242,9 @@ public static LinkerResourceCollection GetLinkerResources(this ArmClient client, /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public static async Task> GetLinkerResourceAsync(this ArmResource armResource, string linkerName, CancellationToken cancellationToken = default) + public static async Task> GetLinkerAsync(this ArmResource armResource, string linkerName, CancellationToken cancellationToken = default) { - return await armResource.GetLinkerResources().GetAsync(linkerName, cancellationToken).ConfigureAwait(false); + return await armResource.GetLinkers().GetAsync(linkerName, cancellationToken).ConfigureAwait(false); } /// @@ -80,9 +259,9 @@ public static async Task> GetLinkerResourceAsync(this A /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public static async Task> GetLinkerResourceAsync(this ArmClient client, ResourceIdentifier scope, string linkerName, CancellationToken cancellationToken = default) + public static async Task> GetLinkerAsync(this ArmClient client, ResourceIdentifier scope, string linkerName, CancellationToken cancellationToken = default) { - return await client.GetLinkerResources(scope).GetAsync(linkerName, cancellationToken).ConfigureAwait(false); + return await client.GetLinkers(scope).GetAsync(linkerName, cancellationToken).ConfigureAwait(false); } /// @@ -96,9 +275,9 @@ public static async Task> GetLinkerResourceAsync(this A /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public static Response GetLinkerResource(this ArmResource armResource, string linkerName, CancellationToken cancellationToken = default) + public static Response GetLinker(this ArmResource armResource, string linkerName, CancellationToken cancellationToken = default) { - return armResource.GetLinkerResources().Get(linkerName, cancellationToken); + return armResource.GetLinkers().Get(linkerName, cancellationToken); } /// @@ -113,10 +292,67 @@ public static Response GetLinkerResource(this ArmResource armRes /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public static Response GetLinkerResource(this ArmClient client, ResourceIdentifier scope, string linkerName, CancellationToken cancellationToken = default) + public static Response GetLinker(this ArmClient client, ResourceIdentifier scope, string linkerName, CancellationToken cancellationToken = default) + { + return client.GetLinkers(scope).Get(linkerName, cancellationToken); + } + + #region LocationDryrunResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static LocationDryrunResource GetLocationDryrunResource(this ArmClient client, ResourceIdentifier id) { - return client.GetLinkerResources(scope).Get(linkerName, cancellationToken); + return client.GetResourceClient(() => + { + LocationDryrunResource.ValidateResourceId(id); + return new LocationDryrunResource(client, id); + } + ); } + #endregion + + #region DryrunResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static DryrunResource GetDryrunResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DryrunResource.ValidateResourceId(id); + return new DryrunResource(client, id); + } + ); + } + #endregion + + #region LocationConnectorResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static LocationConnectorResource GetLocationConnectorResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + LocationConnectorResource.ValidateResourceId(id); + return new LocationConnectorResource(client, id); + } + ); + } + #endregion #region LinkerResource /// diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/TenantResourceExtensionClient.cs new file mode 100644 index 000000000000..63849751c34a --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/TenantResourceExtensionClient.cs @@ -0,0 +1,134 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker +{ + /// A class to add extension methods to TenantResource. + internal partial class TenantResourceExtensionClient : ArmResource + { + private ClientDiagnostics _configurationNamesClientDiagnostics; + private ConfigurationNamesRestOperations _configurationNamesRestClient; + + /// Initializes a new instance of the class for mocking. + protected TenantResourceExtensionClient() + { + } + + /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ConfigurationNamesClientDiagnostics => _configurationNamesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ConfigurationNamesRestOperations ConfigurationNamesRestClient => _configurationNamesRestClient ??= new ConfigurationNamesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists the configuration names generated by Service Connector for all target, client types, auth types. + /// Request Path: /providers/Microsoft.ServiceLinker/configurationNames + /// Operation Id: ConfigurationNames_List + /// + /// OData filter options. + /// OData skipToken option for pagination. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConfigurationNamesAsync(string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = ConfigurationNamesClientDiagnostics.CreateScope("TenantResourceExtensionClient.GetConfigurationNames"); + scope.Start(); + try + { + var response = await ConfigurationNamesRestClient.ListAsync(filter, skipToken, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = ConfigurationNamesClientDiagnostics.CreateScope("TenantResourceExtensionClient.GetConfigurationNames"); + scope.Start(); + try + { + var response = await ConfigurationNamesRestClient.ListNextPageAsync(nextLink, filter, skipToken, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Lists the configuration names generated by Service Connector for all target, client types, auth types. + /// Request Path: /providers/Microsoft.ServiceLinker/configurationNames + /// Operation Id: ConfigurationNames_List + /// + /// OData filter options. + /// OData skipToken option for pagination. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConfigurationNames(string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = ConfigurationNamesClientDiagnostics.CreateScope("TenantResourceExtensionClient.GetConfigurationNames"); + scope.Start(); + try + { + var response = ConfigurationNamesRestClient.List(filter, skipToken, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = ConfigurationNamesClientDiagnostics.CreateScope("TenantResourceExtensionClient.GetConfigurationNames"); + scope.Start(); + try + { + var response = ConfigurationNamesRestClient.ListNextPage(nextLink, filter, skipToken, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceCollection.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerCollection.cs similarity index 76% rename from sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceCollection.cs rename to sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerCollection.cs index 67651b9439d8..5551146ce936 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceCollection.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerCollection.cs @@ -21,30 +21,30 @@ namespace Azure.ResourceManager.ServiceLinker /// /// 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 GetLinkerResources method from an instance of . + /// To get a instance call the GetLinkers method from an instance of . /// - public partial class LinkerResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class LinkerCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _linkerResourceLinkerClientDiagnostics; - private readonly LinkerRestOperations _linkerResourceLinkerRestClient; + private readonly ClientDiagnostics _linkerClientDiagnostics; + private readonly LinkerRestOperations _linkerRestClient; - /// Initializes a new instance of the class for mocking. - protected LinkerResourceCollection() + /// Initializes a new instance of the class for mocking. + protected LinkerCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal LinkerResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal LinkerCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _linkerResourceLinkerClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", LinkerResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(LinkerResource.ResourceType, out string linkerResourceLinkerApiVersion); - _linkerResourceLinkerRestClient = new LinkerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, linkerResourceLinkerApiVersion); + _linkerClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", LinkerResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(LinkerResource.ResourceType, out string linkerApiVersion); + _linkerRestClient = new LinkerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, linkerApiVersion); } /// - /// Create or update linker resource. + /// Create or update Linker resource. /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName} /// Operation Id: Linker_CreateOrUpdate /// @@ -59,12 +59,12 @@ public virtual async Task> CreateOrUpdateAsync(Wait Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.CreateOrUpdate"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _linkerResourceLinkerRestClient.CreateOrUpdateAsync(Id, linkerName, data, cancellationToken).ConfigureAwait(false); - var operation = new ServiceLinkerArmOperation(new LinkerResourceOperationSource(Client), _linkerResourceLinkerClientDiagnostics, Pipeline, _linkerResourceLinkerRestClient.CreateCreateOrUpdateRequest(Id, linkerName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _linkerRestClient.CreateOrUpdateAsync(Id, linkerName, data, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new LinkerOperationSource(Client), _linkerClientDiagnostics, Pipeline, _linkerRestClient.CreateCreateOrUpdateRequest(Id, linkerName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -77,7 +77,7 @@ public virtual async Task> CreateOrUpdateAsync(Wait } /// - /// Create or update linker resource. + /// Create or update Linker resource. /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName} /// Operation Id: Linker_CreateOrUpdate /// @@ -92,12 +92,12 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.CreateOrUpdate"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerCollection.CreateOrUpdate"); scope.Start(); try { - var response = _linkerResourceLinkerRestClient.CreateOrUpdate(Id, linkerName, data, cancellationToken); - var operation = new ServiceLinkerArmOperation(new LinkerResourceOperationSource(Client), _linkerResourceLinkerClientDiagnostics, Pipeline, _linkerResourceLinkerRestClient.CreateCreateOrUpdateRequest(Id, linkerName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _linkerRestClient.CreateOrUpdate(Id, linkerName, data, cancellationToken); + var operation = new ServiceLinkerArmOperation(new LinkerOperationSource(Client), _linkerClientDiagnostics, Pipeline, _linkerRestClient.CreateCreateOrUpdateRequest(Id, linkerName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -122,11 +122,11 @@ public virtual async Task> GetAsync(string linkerName, { Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.Get"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerCollection.Get"); scope.Start(); try { - var response = await _linkerResourceLinkerRestClient.GetAsync(Id, linkerName, cancellationToken).ConfigureAwait(false); + var response = await _linkerRestClient.GetAsync(Id, linkerName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new LinkerResource(Client, response.Value), response.GetRawResponse()); @@ -151,11 +151,11 @@ public virtual Response Get(string linkerName, CancellationToken { Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.Get"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerCollection.Get"); scope.Start(); try { - var response = _linkerResourceLinkerRestClient.Get(Id, linkerName, cancellationToken); + var response = _linkerRestClient.Get(Id, linkerName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new LinkerResource(Client, response.Value), response.GetRawResponse()); @@ -168,7 +168,7 @@ public virtual Response Get(string linkerName, CancellationToken } /// - /// Returns list of Linkers which connects to the resource. + /// Returns list of Linkers which connects to the resource. which supports to config both application and target service during the resource provision. /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/linkers /// Operation Id: Linker_List /// @@ -178,11 +178,11 @@ public virtual AsyncPageable GetAllAsync(CancellationToken cance { async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.GetAll"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerCollection.GetAll"); scope.Start(); try { - var response = await _linkerResourceLinkerRestClient.ListAsync(Id, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _linkerRestClient.ListAsync(Id, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new LinkerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -193,11 +193,11 @@ async Task> FirstPageFunc(int? pageSizeHint) } async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.GetAll"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerCollection.GetAll"); scope.Start(); try { - var response = await _linkerResourceLinkerRestClient.ListNextPageAsync(nextLink, Id, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _linkerRestClient.ListNextPageAsync(nextLink, Id, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new LinkerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -210,7 +210,7 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint } /// - /// Returns list of Linkers which connects to the resource. + /// Returns list of Linkers which connects to the resource. which supports to config both application and target service during the resource provision. /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/linkers /// Operation Id: Linker_List /// @@ -220,11 +220,11 @@ public virtual Pageable GetAll(CancellationToken cancellationTok { Page FirstPageFunc(int? pageSizeHint) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.GetAll"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerCollection.GetAll"); scope.Start(); try { - var response = _linkerResourceLinkerRestClient.List(Id, cancellationToken: cancellationToken); + var response = _linkerRestClient.List(Id, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new LinkerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -235,11 +235,11 @@ Page FirstPageFunc(int? pageSizeHint) } Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.GetAll"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerCollection.GetAll"); scope.Start(); try { - var response = _linkerResourceLinkerRestClient.ListNextPage(nextLink, Id, cancellationToken: cancellationToken); + var response = _linkerRestClient.ListNextPage(nextLink, Id, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new LinkerResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -264,11 +264,11 @@ public virtual async Task> ExistsAsync(string linkerName, Cancell { Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.Exists"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerCollection.Exists"); scope.Start(); try { - var response = await _linkerResourceLinkerRestClient.GetAsync(Id, linkerName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _linkerRestClient.GetAsync(Id, linkerName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -291,11 +291,11 @@ public virtual Response Exists(string linkerName, CancellationToken cancel { Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.Exists"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerCollection.Exists"); scope.Start(); try { - var response = _linkerResourceLinkerRestClient.Get(Id, linkerName, cancellationToken: cancellationToken); + var response = _linkerRestClient.Get(Id, linkerName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResource.cs index 7570d7026131..dd9b5f7409bf 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResource.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResource.cs @@ -18,10 +18,10 @@ namespace Azure.ResourceManager.ServiceLinker { /// - /// A Class representing a LinkerResource along with the instance operations that can be performed on it. + /// A Class representing a Linker 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 GetLinkerResource method. - /// Otherwise you can get one from its parent resource using the GetLinkerResource method. + /// Otherwise you can get one from its parent resource using the GetLinker method. /// public partial class LinkerResource : ArmResource { @@ -32,8 +32,10 @@ public static ResourceIdentifier CreateResourceIdentifier(string resourceUri, st return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _linkerResourceLinkerClientDiagnostics; - private readonly LinkerRestOperations _linkerResourceLinkerRestClient; + private readonly ClientDiagnostics _linkerClientDiagnostics; + private readonly LinkerRestOperations _linkerRestClient; + private readonly ClientDiagnostics _dryrunLinkersClientDiagnostics; + private readonly LinkersRestOperations _dryrunLinkersRestClient; private readonly LinkerResourceData _data; /// Initializes a new instance of the class for mocking. @@ -55,9 +57,12 @@ internal LinkerResource(ArmClient client, LinkerResourceData data) : this(client /// The identifier of the resource that is the target of operations. internal LinkerResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _linkerResourceLinkerClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string linkerResourceLinkerApiVersion); - _linkerResourceLinkerRestClient = new LinkerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, linkerResourceLinkerApiVersion); + _linkerClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string linkerApiVersion); + _linkerRestClient = new LinkerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, linkerApiVersion); + _dryrunLinkersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", DryrunResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DryrunResource.ResourceType, out string dryrunLinkersApiVersion); + _dryrunLinkersRestClient = new LinkersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dryrunLinkersApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -95,11 +100,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.Get"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.Get"); scope.Start(); try { - var response = await _linkerResourceLinkerRestClient.GetAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _linkerRestClient.GetAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new LinkerResource(Client, response.Value), response.GetRawResponse()); @@ -119,11 +124,11 @@ public virtual async Task> GetAsync(CancellationToken c /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.Get"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.Get"); scope.Start(); try { - var response = _linkerResourceLinkerRestClient.Get(Id.Parent, Id.Name, cancellationToken); + var response = _linkerRestClient.Get(Id.Parent, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new LinkerResource(Client, response.Value), response.GetRawResponse()); @@ -136,7 +141,7 @@ public virtual Response Get(CancellationToken cancellationToken } /// - /// Delete a link. + /// Delete a Linker. /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName} /// Operation Id: Linker_Delete /// @@ -144,12 +149,12 @@ public virtual Response Get(CancellationToken cancellationToken /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.Delete"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.Delete"); scope.Start(); try { - var response = await _linkerResourceLinkerRestClient.DeleteAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ServiceLinkerArmOperation(_linkerResourceLinkerClientDiagnostics, Pipeline, _linkerResourceLinkerRestClient.CreateDeleteRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _linkerRestClient.DeleteAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(_linkerClientDiagnostics, Pipeline, _linkerRestClient.CreateDeleteRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -162,7 +167,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete a link. + /// Delete a Linker. /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName} /// Operation Id: Linker_Delete /// @@ -170,12 +175,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.Delete"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.Delete"); scope.Start(); try { - var response = _linkerResourceLinkerRestClient.Delete(Id.Parent, Id.Name, cancellationToken); - var operation = new ServiceLinkerArmOperation(_linkerResourceLinkerClientDiagnostics, Pipeline, _linkerResourceLinkerRestClient.CreateDeleteRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _linkerRestClient.Delete(Id.Parent, Id.Name, cancellationToken); + var operation = new ServiceLinkerArmOperation(_linkerClientDiagnostics, Pipeline, _linkerRestClient.CreateDeleteRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -188,7 +193,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Operation to update an existing link. + /// Operation to update an existing Linker. /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName} /// Operation Id: Linker_Update /// @@ -196,16 +201,16 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// Linker details. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, LinkerResourcePatch patch, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, LinkerPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.Update"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.Update"); scope.Start(); try { - var response = await _linkerResourceLinkerRestClient.UpdateAsync(Id.Parent, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new ServiceLinkerArmOperation(new LinkerResourceOperationSource(Client), _linkerResourceLinkerClientDiagnostics, Pipeline, _linkerResourceLinkerRestClient.CreateUpdateRequest(Id.Parent, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _linkerRestClient.UpdateAsync(Id.Parent, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new LinkerOperationSource(Client), _linkerClientDiagnostics, Pipeline, _linkerRestClient.CreateUpdateRequest(Id.Parent, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -218,7 +223,7 @@ public virtual async Task> UpdateAsync(WaitUntil wa } /// - /// Operation to update an existing link. + /// Operation to update an existing Linker. /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName} /// Operation Id: Linker_Update /// @@ -226,16 +231,16 @@ public virtual async Task> UpdateAsync(WaitUntil wa /// Linker details. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, LinkerResourcePatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, LinkerPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.Update"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.Update"); scope.Start(); try { - var response = _linkerResourceLinkerRestClient.Update(Id.Parent, Id.Name, patch, cancellationToken); - var operation = new ServiceLinkerArmOperation(new LinkerResourceOperationSource(Client), _linkerResourceLinkerClientDiagnostics, Pipeline, _linkerResourceLinkerRestClient.CreateUpdateRequest(Id.Parent, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _linkerRestClient.Update(Id.Parent, Id.Name, patch, cancellationToken); + var operation = new ServiceLinkerArmOperation(new LinkerOperationSource(Client), _linkerClientDiagnostics, Pipeline, _linkerRestClient.CreateUpdateRequest(Id.Parent, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -248,7 +253,7 @@ public virtual ArmOperation Update(WaitUntil waitUntil, LinkerRe } /// - /// Validate a link. + /// Validate a Linker. /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/validateLinker /// Operation Id: Linker_Validate /// @@ -256,12 +261,12 @@ public virtual ArmOperation Update(WaitUntil waitUntil, LinkerRe /// The cancellation token to use. public virtual async Task> ValidateAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.Validate"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.Validate"); scope.Start(); try { - var response = await _linkerResourceLinkerRestClient.ValidateAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ServiceLinkerArmOperation(new LinkerValidateOperationResultOperationSource(), _linkerResourceLinkerClientDiagnostics, Pipeline, _linkerResourceLinkerRestClient.CreateValidateRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _linkerRestClient.ValidateAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new LinkerValidateOperationResultOperationSource(), _linkerClientDiagnostics, Pipeline, _linkerRestClient.CreateValidateRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -274,7 +279,7 @@ public virtual async Task> ValidateA } /// - /// Validate a link. + /// Validate a Linker. /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/validateLinker /// Operation Id: Linker_Validate /// @@ -282,12 +287,12 @@ public virtual async Task> ValidateA /// The cancellation token to use. public virtual ArmOperation Validate(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.Validate"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.Validate"); scope.Start(); try { - var response = _linkerResourceLinkerRestClient.Validate(Id.Parent, Id.Name, cancellationToken); - var operation = new ServiceLinkerArmOperation(new LinkerValidateOperationResultOperationSource(), _linkerResourceLinkerClientDiagnostics, Pipeline, _linkerResourceLinkerRestClient.CreateValidateRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _linkerRestClient.Validate(Id.Parent, Id.Name, cancellationToken); + var operation = new ServiceLinkerArmOperation(new LinkerValidateOperationResultOperationSource(), _linkerClientDiagnostics, Pipeline, _linkerRestClient.CreateValidateRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -300,18 +305,18 @@ public virtual ArmOperation Validate(WaitUntil wa } /// - /// list source configurations for a linker. + /// list source configurations for a Linker. /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/listConfigurations /// Operation Id: Linker_ListConfigurations /// /// The cancellation token to use. - public virtual async Task> GetConfigurationsAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetConfigurationsAsync(CancellationToken cancellationToken = default) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.GetConfigurations"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.GetConfigurations"); scope.Start(); try { - var response = await _linkerResourceLinkerRestClient.ListConfigurationsAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _linkerRestClient.ListConfigurationsAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -322,18 +327,64 @@ public virtual async Task> GetConfigurations } /// - /// list source configurations for a linker. + /// list source configurations for a Linker. /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/listConfigurations /// Operation Id: Linker_ListConfigurations /// /// The cancellation token to use. - public virtual Response GetConfigurations(CancellationToken cancellationToken = default) + public virtual Response GetConfigurations(CancellationToken cancellationToken = default) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.GetConfigurations"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.GetConfigurations"); scope.Start(); try { - var response = _linkerResourceLinkerRestClient.ListConfigurations(Id.Parent, Id.Name, cancellationToken); + var response = _linkerRestClient.ListConfigurations(Id.Parent, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Generate configurations for a Linker. + /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/generateConfigurations + /// Operation Id: Linkers_GenerateConfigurations + /// + /// Connection Info, including format, secret store, etc. + /// The cancellation token to use. + public virtual async Task> GenerateConfigurationsAsync(ConfigurationInfo info = null, CancellationToken cancellationToken = default) + { + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("LinkerResource.GenerateConfigurations"); + scope.Start(); + try + { + var response = await _dryrunLinkersRestClient.GenerateConfigurationsAsync(Id.Parent, Id.Name, info, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Generate configurations for a Linker. + /// Request Path: /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/generateConfigurations + /// Operation Id: Linkers_GenerateConfigurations + /// + /// Connection Info, including format, secret store, etc. + /// The cancellation token to use. + public virtual Response GenerateConfigurations(ConfigurationInfo info = null, CancellationToken cancellationToken = default) + { + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("LinkerResource.GenerateConfigurations"); + scope.Start(); + try + { + var response = _dryrunLinkersRestClient.GenerateConfigurations(Id.Parent, Id.Name, info, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceData.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceData.cs index 7cbfd762dde8..3f51c78930f1 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceData.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceData.cs @@ -27,19 +27,21 @@ public LinkerResourceData() /// /// The target service properties /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . + /// The available derived classes include , , and . /// /// /// The authentication type. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . + /// The available derived classes include , , , , , and . /// /// The application client type. /// The provisioning state. /// The VNet solution. /// An option to store secret value in secure place. /// connection scope in source service. - internal LinkerResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, TargetServiceBaseInfo targetService, AuthBaseInfo authInfo, LinkerClientType? clientType, string provisioningState, VnetSolution vnetSolution, LinkerSecretStore secretStore, string scope) : base(id, name, resourceType, systemData) + /// The network solution. + /// The connection information consumed by applications, including secrets, connection strings. + internal LinkerResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, TargetServiceBaseInfo targetService, AuthBaseInfo authInfo, LinkerClientType? clientType, string provisioningState, VnetSolution vnetSolution, LinkerSecretStore secretStore, string scope, PublicNetworkSolution publicNetworkSolution, ConfigurationInfo configurationInfo) : base(id, name, resourceType, systemData) { TargetService = targetService; AuthInfo = authInfo; @@ -48,18 +50,20 @@ internal LinkerResourceData(ResourceIdentifier id, string name, ResourceType res VnetSolution = vnetSolution; SecretStore = secretStore; Scope = scope; + PublicNetworkSolution = publicNetworkSolution; + ConfigurationInfo = configurationInfo; } /// /// The target service properties /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . + /// The available derived classes include , , and . /// public TargetServiceBaseInfo TargetService { get; set; } /// /// The authentication type. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . + /// The available derived classes include , , , , , and . /// public AuthBaseInfo AuthInfo { get; set; } /// The application client type. @@ -67,34 +71,14 @@ internal LinkerResourceData(ResourceIdentifier id, string name, ResourceType res /// The provisioning state. public string ProvisioningState { get; } /// The VNet solution. - internal VnetSolution VnetSolution { get; set; } - /// Type of VNet solution. - public VnetSolutionType? SolutionType - { - get => VnetSolution is null ? default : VnetSolution.SolutionType; - set - { - if (VnetSolution is null) - VnetSolution = new VnetSolution(); - VnetSolution.SolutionType = value; - } - } - + public VnetSolution VnetSolution { get; set; } /// An option to store secret value in secure place. - internal LinkerSecretStore SecretStore { get; set; } - /// The key vault id to store secret. - public ResourceIdentifier SecretStoreKeyVaultId - { - get => SecretStore is null ? default : SecretStore.KeyVaultId; - set - { - if (SecretStore is null) - SecretStore = new LinkerSecretStore(); - SecretStore.KeyVaultId = value; - } - } - + public LinkerSecretStore SecretStore { get; set; } /// connection scope in source service. public string Scope { get; set; } + /// The network solution. + public PublicNetworkSolution PublicNetworkSolution { get; set; } + /// The connection information consumed by applications, including secrets, connection strings. + public ConfigurationInfo ConfigurationInfo { get; set; } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorCollection.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorCollection.cs new file mode 100644 index 000000000000..61f5aac7d35a --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorCollection.cs @@ -0,0 +1,337 @@ +// 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.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ServiceLinker +{ + /// + /// 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 GetLocationConnectors method from an instance of . + /// + public partial class LocationConnectorCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _locationConnectorConnectorClientDiagnostics; + private readonly ConnectorRestOperations _locationConnectorConnectorRestClient; + private readonly AzureLocation _location; + + /// Initializes a new instance of the class for mocking. + protected LocationConnectorCollection() + { + } + + /// 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. + /// The name of Azure region. + internal LocationConnectorCollection(ArmClient client, ResourceIdentifier id, AzureLocation location) : base(client, id) + { + _location = location; + _locationConnectorConnectorClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", LocationConnectorResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(LocationConnectorResource.ResourceType, out string locationConnectorConnectorApiVersion); + _locationConnectorConnectorRestClient = new ConnectorRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, locationConnectorConnectorApiVersion); +#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 or update Connector resource. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// Operation Id: Connector_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of resource. + /// Connector details. + /// 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 connectorName, LinkerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _locationConnectorConnectorRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), connectorName, data, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new LocationConnectorOperationSource(Client), _locationConnectorConnectorClientDiagnostics, Pipeline, _locationConnectorConnectorRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), connectorName, 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 or update Connector resource. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// Operation Id: Connector_CreateOrUpdate + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of resource. + /// Connector details. + /// 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 connectorName, LinkerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _locationConnectorConnectorRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), connectorName, data, cancellationToken); + var operation = new ServiceLinkerArmOperation(new LocationConnectorOperationSource(Client), _locationConnectorConnectorClientDiagnostics, Pipeline, _locationConnectorConnectorRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), connectorName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns Connector resource for a given name. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// Operation Id: Connector_Get + /// + /// The name of 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 connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorCollection.Get"); + scope.Start(); + try + { + var response = await _locationConnectorConnectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), connectorName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LocationConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns Connector resource for a given name. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// Operation Id: Connector_Get + /// + /// The name of resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorCollection.Get"); + scope.Start(); + try + { + var response = _locationConnectorConnectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), connectorName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LocationConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns list of connector which connects to the resource, which supports to config the target service during the resource provision. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors + /// Operation Id: Connector_List + /// + /// 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) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorCollection.GetAll"); + scope.Start(); + try + { + var response = await _locationConnectorConnectorRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new LocationConnectorResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorCollection.GetAll"); + scope.Start(); + try + { + var response = await _locationConnectorConnectorRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new LocationConnectorResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Returns list of connector which connects to the resource, which supports to config the target service during the resource provision. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors + /// Operation Id: Connector_List + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorCollection.GetAll"); + scope.Start(); + try + { + var response = _locationConnectorConnectorRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new LocationConnectorResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorCollection.GetAll"); + scope.Start(); + try + { + var response = _locationConnectorConnectorRestClient.ListNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new LocationConnectorResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Checks to see if the resource exists in azure. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// Operation Id: Connector_Get + /// + /// The name of 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 connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorCollection.Exists"); + scope.Start(); + try + { + var response = await _locationConnectorConnectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), connectorName, 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.ServiceLinker/locations/{location}/connectors/{connectorName} + /// Operation Id: Connector_Get + /// + /// The name of resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorCollection.Exists"); + scope.Start(); + try + { + var response = _locationConnectorConnectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), connectorName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorResource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorResource.cs new file mode 100644 index 000000000000..47fb642f46dc --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorResource.cs @@ -0,0 +1,349 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker +{ + /// + /// A Class representing a LocationConnector 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 GetLocationConnectorResource method. + /// Otherwise you can get one from its parent resource using the GetLocationConnector method. + /// + public partial class LocationConnectorResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _locationConnectorConnectorClientDiagnostics; + private readonly ConnectorRestOperations _locationConnectorConnectorRestClient; + private readonly LinkerResourceData _data; + + /// Initializes a new instance of the class for mocking. + protected LocationConnectorResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal LocationConnectorResource(ArmClient client, LinkerResourceData 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 LocationConnectorResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _locationConnectorConnectorClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string locationConnectorConnectorApiVersion); + _locationConnectorConnectorRestClient = new ConnectorRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, locationConnectorConnectorApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ServiceLinker/locations/connectors"; + + /// 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 LinkerResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Returns Connector resource for a given name. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// Operation Id: Connector_Get + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.Get"); + scope.Start(); + try + { + var response = await _locationConnectorConnectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LocationConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns Connector resource for a given name. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// Operation Id: Connector_Get + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.Get"); + scope.Start(); + try + { + var response = _locationConnectorConnectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LocationConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Connector. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// Operation Id: Connector_Delete + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.Delete"); + scope.Start(); + try + { + var response = await _locationConnectorConnectorRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(_locationConnectorConnectorClientDiagnostics, Pipeline, _locationConnectorConnectorRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Connector. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// Operation Id: Connector_Delete + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.Delete"); + scope.Start(); + try + { + var response = _locationConnectorConnectorRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken); + var operation = new ServiceLinkerArmOperation(_locationConnectorConnectorClientDiagnostics, Pipeline, _locationConnectorConnectorRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Operation to update an existing Connector. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// Operation Id: Connector_Update + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Connector details. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, LinkerPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.Update"); + scope.Start(); + try + { + var response = await _locationConnectorConnectorRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new LocationConnectorOperationSource(Client), _locationConnectorConnectorClientDiagnostics, Pipeline, _locationConnectorConnectorRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Operation to update an existing Connector. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// Operation Id: Connector_Update + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Connector details. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, LinkerPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.Update"); + scope.Start(); + try + { + var response = _locationConnectorConnectorRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, patch, cancellationToken); + var operation = new ServiceLinkerArmOperation(new LocationConnectorOperationSource(Client), _locationConnectorConnectorClientDiagnostics, Pipeline, _locationConnectorConnectorRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Validate a Connector. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate + /// Operation Id: Connector_Validate + /// + /// 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> ValidateAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.Validate"); + scope.Start(); + try + { + var response = await _locationConnectorConnectorRestClient.ValidateAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new LinkerValidateOperationResultOperationSource(), _locationConnectorConnectorClientDiagnostics, Pipeline, _locationConnectorConnectorRestClient.CreateValidateRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Validate a Connector. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate + /// Operation Id: Connector_Validate + /// + /// 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 Validate(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.Validate"); + scope.Start(); + try + { + var response = _locationConnectorConnectorRestClient.Validate(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken); + var operation = new ServiceLinkerArmOperation(new LinkerValidateOperationResultOperationSource(), _locationConnectorConnectorClientDiagnostics, Pipeline, _locationConnectorConnectorRestClient.CreateValidateRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Generate configurations for a Connector. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/generateConfigurations + /// Operation Id: Connector_GenerateConfigurations + /// + /// Connection Info, including format, secret store, etc. + /// The cancellation token to use. + public virtual async Task> GenerateConfigurationsAsync(ConfigurationInfo info = null, CancellationToken cancellationToken = default) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.GenerateConfigurations"); + scope.Start(); + try + { + var response = await _locationConnectorConnectorRestClient.GenerateConfigurationsAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, info, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Generate configurations for a Connector. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/generateConfigurations + /// Operation Id: Connector_GenerateConfigurations + /// + /// Connection Info, including format, secret store, etc. + /// The cancellation token to use. + public virtual Response GenerateConfigurations(ConfigurationInfo info = null, CancellationToken cancellationToken = default) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.GenerateConfigurations"); + scope.Start(); + try + { + var response = _locationConnectorConnectorRestClient.GenerateConfigurations(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, info, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunCollection.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunCollection.cs new file mode 100644 index 000000000000..37f3b7b94de8 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunCollection.cs @@ -0,0 +1,337 @@ +// 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.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ServiceLinker +{ + /// + /// 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 GetLocationDryruns method from an instance of . + /// + public partial class LocationDryrunCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _locationDryrunConnectorClientDiagnostics; + private readonly ConnectorRestOperations _locationDryrunConnectorRestClient; + private readonly AzureLocation _location; + + /// Initializes a new instance of the class for mocking. + protected LocationDryrunCollection() + { + } + + /// 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. + /// The name of Azure region. + internal LocationDryrunCollection(ArmClient client, ResourceIdentifier id, AzureLocation location) : base(client, id) + { + _location = location; + _locationDryrunConnectorClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", LocationDryrunResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(LocationDryrunResource.ResourceType, out string locationDryrunConnectorApiVersion); + _locationDryrunConnectorRestClient = new ConnectorRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, locationDryrunConnectorApiVersion); +#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 dryrun job to do necessary check before actual creation + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// Operation Id: Connector_CreateDryrun + /// + /// 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 name of dryrun. + /// dryrun resource. + /// 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 dryrunName, DryrunResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _locationDryrunConnectorRestClient.CreateDryrunAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), dryrunName, data, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new LocationDryrunOperationSource(Client), _locationDryrunConnectorClientDiagnostics, Pipeline, _locationDryrunConnectorRestClient.CreateCreateDryrunRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), dryrunName, 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 dryrun job to do necessary check before actual creation + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// Operation Id: Connector_CreateDryrun + /// + /// 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 name of dryrun. + /// dryrun resource. + /// 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 dryrunName, DryrunResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _locationDryrunConnectorRestClient.CreateDryrun(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), dryrunName, data, cancellationToken); + var operation = new ServiceLinkerArmOperation(new LocationDryrunOperationSource(Client), _locationDryrunConnectorClientDiagnostics, Pipeline, _locationDryrunConnectorRestClient.CreateCreateDryrunRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), dryrunName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// get a dryrun job + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// Operation Id: Connector_GetDryrun + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunCollection.Get"); + scope.Start(); + try + { + var response = await _locationDryrunConnectorRestClient.GetDryrunAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), dryrunName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LocationDryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// get a dryrun job + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// Operation Id: Connector_GetDryrun + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunCollection.Get"); + scope.Start(); + try + { + var response = _locationDryrunConnectorRestClient.GetDryrun(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), dryrunName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LocationDryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// list dryrun jobs + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns + /// Operation Id: Connector_ListDryrun + /// + /// 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) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunCollection.GetAll"); + scope.Start(); + try + { + var response = await _locationDryrunConnectorRestClient.ListDryrunAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new LocationDryrunResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunCollection.GetAll"); + scope.Start(); + try + { + var response = await _locationDryrunConnectorRestClient.ListDryrunNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new LocationDryrunResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// list dryrun jobs + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns + /// Operation Id: Connector_ListDryrun + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunCollection.GetAll"); + scope.Start(); + try + { + var response = _locationDryrunConnectorRestClient.ListDryrun(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new LocationDryrunResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunCollection.GetAll"); + scope.Start(); + try + { + var response = _locationDryrunConnectorRestClient.ListDryrunNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new LocationDryrunResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Checks to see if the resource exists in azure. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// Operation Id: Connector_GetDryrun + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunCollection.Exists"); + scope.Start(); + try + { + var response = await _locationDryrunConnectorRestClient.GetDryrunAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), dryrunName, 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.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// Operation Id: Connector_GetDryrun + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunCollection.Exists"); + scope.Start(); + try + { + var response = _locationDryrunConnectorRestClient.GetDryrun(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), dryrunName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunResource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunResource.cs new file mode 100644 index 000000000000..3debb3dff3cd --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunResource.cs @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker +{ + /// + /// A Class representing a LocationDryrun 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 GetLocationDryrunResource method. + /// Otherwise you can get one from its parent resource using the GetLocationDryrun method. + /// + public partial class LocationDryrunResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _locationDryrunConnectorClientDiagnostics; + private readonly ConnectorRestOperations _locationDryrunConnectorRestClient; + private readonly DryrunResourceData _data; + + /// Initializes a new instance of the class for mocking. + protected LocationDryrunResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal LocationDryrunResource(ArmClient client, DryrunResourceData 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 LocationDryrunResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _locationDryrunConnectorClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string locationDryrunConnectorApiVersion); + _locationDryrunConnectorRestClient = new ConnectorRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, locationDryrunConnectorApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ServiceLinker/locations/dryruns"; + + /// 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 DryrunResourceData 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 dryrun job + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// Operation Id: Connector_GetDryrun + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunResource.Get"); + scope.Start(); + try + { + var response = await _locationDryrunConnectorRestClient.GetDryrunAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LocationDryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// get a dryrun job + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// Operation Id: Connector_GetDryrun + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunResource.Get"); + scope.Start(); + try + { + var response = _locationDryrunConnectorRestClient.GetDryrun(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LocationDryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// delete a dryrun job + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// Operation Id: Connector_DeleteDryrun + /// + /// 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 = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunResource.Delete"); + scope.Start(); + try + { + var response = await _locationDryrunConnectorRestClient.DeleteDryrunAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// delete a dryrun job + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// Operation Id: Connector_DeleteDryrun + /// + /// 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 = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunResource.Delete"); + scope.Start(); + try + { + var response = _locationDryrunConnectorRestClient.DeleteDryrun(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken); + var operation = new ServiceLinkerArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// update a dryrun job to do necessary check before actual creation + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// Operation Id: Connector_UpdateDryrun + /// + /// 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. + /// dryrun resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DryrunPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunResource.Update"); + scope.Start(); + try + { + var response = await _locationDryrunConnectorRestClient.UpdateDryrunAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new LocationDryrunOperationSource(Client), _locationDryrunConnectorClientDiagnostics, Pipeline, _locationDryrunConnectorRestClient.CreateUpdateDryrunRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// update a dryrun job to do necessary check before actual creation + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// Operation Id: Connector_UpdateDryrun + /// + /// 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. + /// dryrun resource. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DryrunPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunResource.Update"); + scope.Start(); + try + { + var response = _locationDryrunConnectorRestClient.UpdateDryrun(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, patch, cancellationToken); + var operation = new ServiceLinkerArmOperation(new LocationDryrunOperationSource(Client), _locationDryrunConnectorClientDiagnostics, Pipeline, _locationDryrunConnectorRestClient.CreateUpdateDryrunRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/DryrunOperationSource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/DryrunOperationSource.cs new file mode 100644 index 000000000000..a049e24ba031 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/DryrunOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ServiceLinker +{ + internal class DryrunOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DryrunOperationSource(ArmClient client) + { + _client = client; + } + + DryrunResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DryrunResourceData.DeserializeDryrunResourceData(document.RootElement); + return new DryrunResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DryrunResourceData.DeserializeDryrunResourceData(document.RootElement); + return new DryrunResource(_client, data); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LinkerResourceOperationSource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LinkerOperationSource.cs similarity index 89% rename from sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LinkerResourceOperationSource.cs rename to sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LinkerOperationSource.cs index 8a16516e879d..f7b8de0b9c72 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LinkerResourceOperationSource.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LinkerOperationSource.cs @@ -14,11 +14,11 @@ namespace Azure.ResourceManager.ServiceLinker { - internal class LinkerResourceOperationSource : IOperationSource + internal class LinkerOperationSource : IOperationSource { private readonly ArmClient _client; - internal LinkerResourceOperationSource(ArmClient client) + internal LinkerOperationSource(ArmClient client) { _client = client; } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LocationConnectorOperationSource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LocationConnectorOperationSource.cs new file mode 100644 index 000000000000..3ed6e607707e --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LocationConnectorOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ServiceLinker +{ + internal class LocationConnectorOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal LocationConnectorOperationSource(ArmClient client) + { + _client = client; + } + + LocationConnectorResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = LinkerResourceData.DeserializeLinkerResourceData(document.RootElement); + return new LocationConnectorResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = LinkerResourceData.DeserializeLinkerResourceData(document.RootElement); + return new LocationConnectorResource(_client, data); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LocationDryrunOperationSource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LocationDryrunOperationSource.cs new file mode 100644 index 000000000000..ffafdb078fdf --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LocationDryrunOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ServiceLinker +{ + internal class LocationDryrunOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal LocationDryrunOperationSource(ArmClient client) + { + _client = client; + } + + LocationDryrunResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DryrunResourceData.DeserializeDryrunResourceData(document.RootElement); + return new LocationDryrunResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DryrunResourceData.DeserializeDryrunResourceData(document.RootElement); + return new LocationDryrunResource(_client, data); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyInfoBase.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyInfoBase.Serialization.cs new file mode 100644 index 000000000000..cb53c4160773 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyInfoBase.Serialization.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class AccessKeyInfoBase : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Permissions)) + { + writer.WritePropertyName("permissions"); + writer.WriteStartArray(); + foreach (var item in Permissions) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("authType"); + writer.WriteStringValue(AuthType.ToString()); + writer.WriteEndObject(); + } + + internal static AccessKeyInfoBase DeserializeAccessKeyInfoBase(JsonElement element) + { + Optional> permissions = default; + LinkerAuthType authType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("permissions")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new AccessKeyPermission(item.GetString())); + } + permissions = array; + continue; + } + if (property.NameEquals("authType")) + { + authType = new LinkerAuthType(property.Value.GetString()); + continue; + } + } + return new AccessKeyInfoBase(authType, Optional.ToList(permissions)); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyInfoBase.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyInfoBase.cs new file mode 100644 index 000000000000..badca23f13aa --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyInfoBase.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The access key directly from target resource properties, which target service is Azure Resource, such as Microsoft.Storage. + public partial class AccessKeyInfoBase : AuthBaseInfo + { + /// Initializes a new instance of AccessKeyInfoBase. + public AccessKeyInfoBase() + { + Permissions = new ChangeTrackingList(); + AuthType = LinkerAuthType.AccessKey; + } + + /// Initializes a new instance of AccessKeyInfoBase. + /// The authentication type. + /// Permissions of the accessKey. `Read` and `Write` are for Azure Cosmos DB and Azure App Configuration, `Listen`, `Send` and `Manage` are for Azure Event Hub and Azure Service Bus. + internal AccessKeyInfoBase(LinkerAuthType authType, IList permissions) : base(authType) + { + Permissions = permissions; + AuthType = authType; + } + + /// Permissions of the accessKey. `Read` and `Write` are for Azure Cosmos DB and Azure App Configuration, `Listen`, `Send` and `Manage` are for Azure Event Hub and Azure Service Bus. + public IList Permissions { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyPermission.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyPermission.cs new file mode 100644 index 000000000000..a8d5ff5a4e80 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyPermission.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.ServiceLinker.Models +{ + /// The AccessKeyPermission. + public readonly partial struct AccessKeyPermission : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AccessKeyPermission(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ReadValue = "Read"; + private const string WriteValue = "Write"; + private const string ListenValue = "Listen"; + private const string SendValue = "Send"; + private const string ManageValue = "Manage"; + + /// Read. + public static AccessKeyPermission Read { get; } = new AccessKeyPermission(ReadValue); + /// Write. + public static AccessKeyPermission Write { get; } = new AccessKeyPermission(WriteValue); + /// Listen. + public static AccessKeyPermission Listen { get; } = new AccessKeyPermission(ListenValue); + /// Send. + public static AccessKeyPermission Send { get; } = new AccessKeyPermission(SendValue); + /// Manage. + public static AccessKeyPermission Manage { get; } = new AccessKeyPermission(ManageValue); + /// Determines if two values are the same. + public static bool operator ==(AccessKeyPermission left, AccessKeyPermission right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AccessKeyPermission left, AccessKeyPermission right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AccessKeyPermission(string value) => new AccessKeyPermission(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AccessKeyPermission other && Equals(other); + /// + public bool Equals(AccessKeyPermission other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ActionType.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ActionType.cs new file mode 100644 index 000000000000..9ebe25844183 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ActionType.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.ServiceLinker.Models +{ + /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + public readonly partial struct ActionType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ActionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InternalValue = "Internal"; + private const string EnableValue = "enable"; + private const string OptOutValue = "optOut"; + + /// Internal. + public static ActionType Internal { get; } = new ActionType(InternalValue); + /// enable. + public static ActionType Enable { get; } = new ActionType(EnableValue); + /// optOut. + public static ActionType OptOut { get; } = new ActionType(OptOutValue); + /// Determines if two values are the same. + public static bool operator ==(ActionType left, ActionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ActionType left, ActionType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ActionType(string value) => new ActionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ActionType other && Equals(other); + /// + public bool Equals(ActionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AllowType.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AllowType.cs new file mode 100644 index 000000000000..a8bdd5b38383 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AllowType.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.ServiceLinker.Models +{ + /// Whether to allow firewall rules. + public readonly partial struct AllowType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AllowType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TrueValue = "true"; + private const string FalseValue = "false"; + + /// true. + public static AllowType True { get; } = new AllowType(TrueValue); + /// false. + public static AllowType False { get; } = new AllowType(FalseValue); + /// Determines if two values are the same. + public static bool operator ==(AllowType left, AllowType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AllowType left, AllowType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AllowType(string value) => new AllowType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AllowType other && Equals(other); + /// + public bool Equals(AllowType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthBaseInfo.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthBaseInfo.Serialization.cs index f1fe383f5dea..4306e1a19cfc 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthBaseInfo.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthBaseInfo.Serialization.cs @@ -26,10 +26,12 @@ internal static AuthBaseInfo DeserializeAuthBaseInfo(JsonElement element) { switch (discriminator.GetString()) { + case "accessKey": return AccessKeyInfoBase.DeserializeAccessKeyInfoBase(element); case "secret": return SecretAuthInfo.DeserializeSecretAuthInfo(element); case "servicePrincipalCertificate": return ServicePrincipalCertificateAuthInfo.DeserializeServicePrincipalCertificateAuthInfo(element); case "servicePrincipalSecret": return ServicePrincipalSecretAuthInfo.DeserializeServicePrincipalSecretAuthInfo(element); case "systemAssignedIdentity": return SystemAssignedIdentityAuthInfo.DeserializeSystemAssignedIdentityAuthInfo(element); + case "userAccount": return UserAccountAuthInfo.DeserializeUserAccountAuthInfo(element); case "userAssignedIdentity": return UserAssignedIdentityAuthInfo.DeserializeUserAssignedIdentityAuthInfo(element); } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthBaseInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthBaseInfo.cs index 7969875c9374..1fdeb0cfad11 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthBaseInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthBaseInfo.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models /// /// The authentication info /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . + /// The available derived classes include , , , , , and . /// public abstract partial class AuthBaseInfo { diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/BasicErrorDryrunPrerequisiteResult.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/BasicErrorDryrunPrerequisiteResult.Serialization.cs new file mode 100644 index 000000000000..b9c6c5c1c3c7 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/BasicErrorDryrunPrerequisiteResult.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class BasicErrorDryrunPrerequisiteResult + { + internal static BasicErrorDryrunPrerequisiteResult DeserializeBasicErrorDryrunPrerequisiteResult(JsonElement element) + { + Optional code = default; + Optional message = default; + DryrunPrerequisiteResultType type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code")) + { + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("message")) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = new DryrunPrerequisiteResultType(property.Value.GetString()); + continue; + } + } + return new BasicErrorDryrunPrerequisiteResult(type, code.Value, message.Value); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/BasicErrorDryrunPrerequisiteResult.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/BasicErrorDryrunPrerequisiteResult.cs new file mode 100644 index 000000000000..362ecf8a2d9b --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/BasicErrorDryrunPrerequisiteResult.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The represent of basic error. + public partial class BasicErrorDryrunPrerequisiteResult : DryrunPrerequisiteResult + { + /// Initializes a new instance of BasicErrorDryrunPrerequisiteResult. + internal BasicErrorDryrunPrerequisiteResult() + { + ResultType = DryrunPrerequisiteResultType.BasicError; + } + + /// Initializes a new instance of BasicErrorDryrunPrerequisiteResult. + /// The type of dryrun result. + /// The error code. + /// The error message. + internal BasicErrorDryrunPrerequisiteResult(DryrunPrerequisiteResultType resultType, string code, string message) : base(resultType) + { + Code = code; + Message = message; + ResultType = resultType; + } + + /// The error code. + public string Code { get; } + /// The error message. + public string Message { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationInfo.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationInfo.Serialization.cs new file mode 100644 index 000000000000..b8cc59c50abc --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationInfo.Serialization.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class ConfigurationInfo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(DeleteOrUpdateBehavior)) + { + writer.WritePropertyName("deleteOrUpdateBehavior"); + writer.WriteStringValue(DeleteOrUpdateBehavior.Value.ToString()); + } + if (Optional.IsDefined(Action)) + { + writer.WritePropertyName("action"); + writer.WriteStringValue(Action.Value.ToString()); + } + if (Optional.IsCollectionDefined(CustomizedKeys)) + { + writer.WritePropertyName("customizedKeys"); + writer.WriteStartObject(); + foreach (var item in CustomizedKeys) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(AdditionalConfigurations)) + { + writer.WritePropertyName("additionalConfigurations"); + writer.WriteStartObject(); + foreach (var item in AdditionalConfigurations) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static ConfigurationInfo DeserializeConfigurationInfo(JsonElement element) + { + Optional deleteOrUpdateBehavior = default; + Optional action = default; + Optional> customizedKeys = default; + Optional> additionalConfigurations = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("deleteOrUpdateBehavior")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + deleteOrUpdateBehavior = new DeleteOrUpdateBehavior(property.Value.GetString()); + continue; + } + if (property.NameEquals("action")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + action = new ActionType(property.Value.GetString()); + continue; + } + if (property.NameEquals("customizedKeys")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + customizedKeys = dictionary; + continue; + } + if (property.NameEquals("additionalConfigurations")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + additionalConfigurations = dictionary; + continue; + } + } + return new ConfigurationInfo(Optional.ToNullable(deleteOrUpdateBehavior), Optional.ToNullable(action), Optional.ToDictionary(customizedKeys), Optional.ToDictionary(additionalConfigurations)); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationInfo.cs new file mode 100644 index 000000000000..e60ff6473a19 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationInfo.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The configuration information, used to generate configurations or save to applications. + public partial class ConfigurationInfo + { + /// Initializes a new instance of ConfigurationInfo. + public ConfigurationInfo() + { + CustomizedKeys = new ChangeTrackingDictionary(); + AdditionalConfigurations = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of ConfigurationInfo. + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + /// Optional, indicate whether to apply configurations on source application. If enable, generate configurations and applied to the source application. Default is enable. If optOut, no configuration change will be made on source. + /// Optional. A dictionary of default key name and customized key name mapping. If not specified, default key name will be used for generate configurations. + /// A dictionary of additional configurations to be added. Service will auto generate a set of basic configurations and this property is to full fill more customized configurations. + internal ConfigurationInfo(DeleteOrUpdateBehavior? deleteOrUpdateBehavior, ActionType? action, IDictionary customizedKeys, IDictionary additionalConfigurations) + { + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + Action = action; + CustomizedKeys = customizedKeys; + AdditionalConfigurations = additionalConfigurations; + } + + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + public DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get; set; } + /// Optional, indicate whether to apply configurations on source application. If enable, generate configurations and applied to the source application. Default is enable. If optOut, no configuration change will be made on source. + public ActionType? Action { get; set; } + /// Optional. A dictionary of default key name and customized key name mapping. If not specified, default key name will be used for generate configurations. + public IDictionary CustomizedKeys { get; } + /// A dictionary of additional configurations to be added. Service will auto generate a set of basic configurations and this property is to full fill more customized configurations. + public IDictionary AdditionalConfigurations { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationName.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationName.Serialization.cs new file mode 100644 index 000000000000..36f49ac7ef9a --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationName.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class ConfigurationName + { + internal static ConfigurationName DeserializeConfigurationName(JsonElement element) + { + Optional value = default; + Optional description = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("description")) + { + description = property.Value.GetString(); + continue; + } + } + return new ConfigurationName(value.Value, description.Value); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationName.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationName.cs new file mode 100644 index 000000000000..0f87003e8d89 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationName.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The configuration names. + public partial class ConfigurationName + { + /// Initializes a new instance of ConfigurationName. + internal ConfigurationName() + { + } + + /// Initializes a new instance of ConfigurationName. + /// + /// Description for the configuration name. + internal ConfigurationName(string value, string description) + { + Value = value; + Description = description; + } + + /// Gets the value. + public string Value { get; } + /// Description for the configuration name. + public string Description { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameItem.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameItem.Serialization.cs new file mode 100644 index 000000000000..b671e23fe52d --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameItem.Serialization.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class ConfigurationNameItem + { + internal static ConfigurationNameItem DeserializeConfigurationNameItem(JsonElement element) + { + Optional targetService = default; + Optional clientType = default; + Optional authType = default; + Optional> names = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("targetService")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + targetService = null; + continue; + } + targetService = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("clientType")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + clientType = null; + continue; + } + clientType = new LinkerClientType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("authType")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + authType = null; + continue; + } + authType = new LinkerAuthType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("names")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + names = null; + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(ConfigurationName.DeserializeConfigurationName(item)); + } + names = array; + continue; + } + } + continue; + } + } + return new ConfigurationNameItem(targetService.Value, Optional.ToNullable(clientType), Optional.ToNullable(authType), Optional.ToList(names)); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameItem.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameItem.cs new file mode 100644 index 000000000000..7a333952ea04 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameItem.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The ConfigurationNameItem. + public partial class ConfigurationNameItem + { + /// Initializes a new instance of ConfigurationNameItem. + internal ConfigurationNameItem() + { + Names = new ChangeTrackingList(); + } + + /// Initializes a new instance of ConfigurationNameItem. + /// The target service provider name and resource name. + /// The client type for configuration names. + /// The auth type. + /// The configuration names to be set in compute service environment. + internal ConfigurationNameItem(string targetService, LinkerClientType? clientType, LinkerAuthType? authType, IReadOnlyList names) + { + TargetService = targetService; + ClientType = clientType; + AuthType = authType; + Names = names; + } + + /// The target service provider name and resource name. + public string TargetService { get; } + /// The client type for configuration names. + public LinkerClientType? ClientType { get; } + /// The auth type. + public LinkerAuthType? AuthType { get; } + /// The configuration names to be set in compute service environment. + public IReadOnlyList Names { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameResult.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameResult.Serialization.cs new file mode 100644 index 000000000000..cc0b867713f7 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + internal partial class ConfigurationNameResult + { + internal static ConfigurationNameResult DeserializeConfigurationNameResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConfigurationNameItem.DeserializeConfigurationNameItem(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ConfigurationNameResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameResult.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameResult.cs new file mode 100644 index 000000000000..83638c68063c --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Configuration Name list which will be set based on different target resource, client type, auth type. + internal partial class ConfigurationNameResult + { + /// Initializes a new instance of ConfigurationNameResult. + internal ConfigurationNameResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ConfigurationNameResult. + /// Expected configuration names for each target service. + /// Link to next page of resources. + internal ConfigurationNameResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Expected configuration names for each target service. + public IReadOnlyList Value { get; } + /// Link to next page of resources. + public string NextLink { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfigurationResult.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationResult.Serialization.cs similarity index 82% rename from sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfigurationResult.Serialization.cs rename to sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationResult.Serialization.cs index 0b0a39182983..56c34551825d 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfigurationResult.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationResult.Serialization.cs @@ -11,9 +11,9 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - public partial class SourceConfigurationResult + public partial class ConfigurationResult { - internal static SourceConfigurationResult DeserializeSourceConfigurationResult(JsonElement element) + internal static ConfigurationResult DeserializeConfigurationResult(JsonElement element) { Optional> configurations = default; foreach (var property in element.EnumerateObject()) @@ -34,7 +34,7 @@ internal static SourceConfigurationResult DeserializeSourceConfigurationResult(J continue; } } - return new SourceConfigurationResult(Optional.ToList(configurations)); + return new ConfigurationResult(Optional.ToList(configurations)); } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfigurationResult.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationResult.cs similarity index 68% rename from sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfigurationResult.cs rename to sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationResult.cs index 850c548c48c3..36f14c3c57e2 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfigurationResult.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationResult.cs @@ -11,17 +11,17 @@ namespace Azure.ResourceManager.ServiceLinker.Models { /// Configurations for source resource, include appSettings, connectionString and serviceBindings. - public partial class SourceConfigurationResult + public partial class ConfigurationResult { - /// Initializes a new instance of SourceConfigurationResult. - internal SourceConfigurationResult() + /// Initializes a new instance of ConfigurationResult. + internal ConfigurationResult() { Configurations = new ChangeTrackingList(); } - /// Initializes a new instance of SourceConfigurationResult. + /// Initializes a new instance of ConfigurationResult. /// The configuration properties for source resource. - internal SourceConfigurationResult(IReadOnlyList configurations) + internal ConfigurationResult(IReadOnlyList configurations) { Configurations = configurations; } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/CreateOrUpdateDryrunParameters.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/CreateOrUpdateDryrunParameters.Serialization.cs new file mode 100644 index 000000000000..ad593dc17bf2 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/CreateOrUpdateDryrunParameters.Serialization.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class CreateOrUpdateDryrunParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TargetService)) + { + writer.WritePropertyName("targetService"); + writer.WriteObjectValue(TargetService); + } + if (Optional.IsDefined(AuthInfo)) + { + writer.WritePropertyName("authInfo"); + writer.WriteObjectValue(AuthInfo); + } + if (Optional.IsDefined(ClientType)) + { + writer.WritePropertyName("clientType"); + writer.WriteStringValue(ClientType.Value.ToString()); + } + if (Optional.IsDefined(VnetSolution)) + { + if (VnetSolution != null) + { + writer.WritePropertyName("vNetSolution"); + writer.WriteObjectValue(VnetSolution); + } + else + { + writer.WriteNull("vNetSolution"); + } + } + if (Optional.IsDefined(SecretStore)) + { + if (SecretStore != null) + { + writer.WritePropertyName("secretStore"); + writer.WriteObjectValue(SecretStore); + } + else + { + writer.WriteNull("secretStore"); + } + } + if (Optional.IsDefined(Scope)) + { + if (Scope != null) + { + writer.WritePropertyName("scope"); + writer.WriteStringValue(Scope); + } + else + { + writer.WriteNull("scope"); + } + } + if (Optional.IsDefined(PublicNetworkSolution)) + { + if (PublicNetworkSolution != null) + { + writer.WritePropertyName("publicNetworkSolution"); + writer.WriteObjectValue(PublicNetworkSolution); + } + else + { + writer.WriteNull("publicNetworkSolution"); + } + } + if (Optional.IsDefined(ConfigurationInfo)) + { + if (ConfigurationInfo != null) + { + writer.WritePropertyName("configurationInfo"); + writer.WriteObjectValue(ConfigurationInfo); + } + else + { + writer.WriteNull("configurationInfo"); + } + } + writer.WritePropertyName("actionName"); + writer.WriteStringValue(ActionName.ToString()); + writer.WriteEndObject(); + } + + internal static CreateOrUpdateDryrunParameters DeserializeCreateOrUpdateDryrunParameters(JsonElement element) + { + Optional targetService = default; + Optional authInfo = default; + Optional clientType = default; + Optional provisioningState = default; + Optional vnetSolution = default; + Optional secretStore = default; + Optional scope = default; + Optional publicNetworkSolution = default; + Optional configurationInfo = default; + DryrunActionName actionName = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targetService")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + targetService = TargetServiceBaseInfo.DeserializeTargetServiceBaseInfo(property.Value); + continue; + } + if (property.NameEquals("authInfo")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + authInfo = AuthBaseInfo.DeserializeAuthBaseInfo(property.Value); + continue; + } + if (property.NameEquals("clientType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + clientType = new LinkerClientType(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState")) + { + provisioningState = property.Value.GetString(); + continue; + } + if (property.NameEquals("vNetSolution")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + vnetSolution = null; + continue; + } + vnetSolution = VnetSolution.DeserializeVnetSolution(property.Value); + continue; + } + if (property.NameEquals("secretStore")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + secretStore = null; + continue; + } + secretStore = LinkerSecretStore.DeserializeLinkerSecretStore(property.Value); + continue; + } + if (property.NameEquals("scope")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + scope = null; + continue; + } + scope = property.Value.GetString(); + continue; + } + if (property.NameEquals("publicNetworkSolution")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + publicNetworkSolution = null; + continue; + } + publicNetworkSolution = PublicNetworkSolution.DeserializePublicNetworkSolution(property.Value); + continue; + } + if (property.NameEquals("configurationInfo")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + configurationInfo = null; + continue; + } + configurationInfo = ConfigurationInfo.DeserializeConfigurationInfo(property.Value); + continue; + } + if (property.NameEquals("actionName")) + { + actionName = new DryrunActionName(property.Value.GetString()); + continue; + } + } + return new CreateOrUpdateDryrunParameters(actionName, targetService.Value, authInfo.Value, Optional.ToNullable(clientType), provisioningState.Value, vnetSolution.Value, secretStore.Value, scope.Value, publicNetworkSolution.Value, configurationInfo.Value); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/CreateOrUpdateDryrunParameters.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/CreateOrUpdateDryrunParameters.cs new file mode 100644 index 000000000000..7f62213ed540 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/CreateOrUpdateDryrunParameters.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The dryrun parameters for creation or update a linker. + public partial class CreateOrUpdateDryrunParameters : DryrunParameters + { + /// Initializes a new instance of CreateOrUpdateDryrunParameters. + public CreateOrUpdateDryrunParameters() + { + ActionName = DryrunActionName.CreateOrUpdate; + } + + /// Initializes a new instance of CreateOrUpdateDryrunParameters. + /// The name of action for you dryrun job. + /// + /// The target service properties + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , and . + /// + /// + /// The authentication type. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , and . + /// + /// The application client type. + /// The provisioning state. + /// The VNet solution. + /// An option to store secret value in secure place. + /// connection scope in source service. + /// The network solution. + /// The connection information consumed by applications, including secrets, connection strings. + internal CreateOrUpdateDryrunParameters(DryrunActionName actionName, TargetServiceBaseInfo targetService, AuthBaseInfo authInfo, LinkerClientType? clientType, string provisioningState, VnetSolution vnetSolution, LinkerSecretStore secretStore, string scope, PublicNetworkSolution publicNetworkSolution, ConfigurationInfo configurationInfo) : base(actionName) + { + TargetService = targetService; + AuthInfo = authInfo; + ClientType = clientType; + ProvisioningState = provisioningState; + VnetSolution = vnetSolution; + SecretStore = secretStore; + Scope = scope; + PublicNetworkSolution = publicNetworkSolution; + ConfigurationInfo = configurationInfo; + ActionName = actionName; + } + + /// + /// The target service properties + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , and . + /// + public TargetServiceBaseInfo TargetService { get; set; } + /// + /// The authentication type. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , and . + /// + public AuthBaseInfo AuthInfo { get; set; } + /// The application client type. + public LinkerClientType? ClientType { get; set; } + /// The provisioning state. + public string ProvisioningState { get; } + /// The VNet solution. + public VnetSolution VnetSolution { get; set; } + /// An option to store secret value in secure place. + public LinkerSecretStore SecretStore { get; set; } + /// connection scope in source service. + public string Scope { get; set; } + /// The network solution. + public PublicNetworkSolution PublicNetworkSolution { get; set; } + /// The connection information consumed by applications, including secrets, connection strings. + public ConfigurationInfo ConfigurationInfo { get; set; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DeleteOrUpdateBehavior.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DeleteOrUpdateBehavior.cs new file mode 100644 index 000000000000..f7f867c67393 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DeleteOrUpdateBehavior.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.ServiceLinker.Models +{ + /// The cleanup behavior to indicate whether clean up operation when resource is deleted or updated. + public readonly partial struct DeleteOrUpdateBehavior : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DeleteOrUpdateBehavior(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "Default"; + private const string ForcedCleanupValue = "ForcedCleanup"; + + /// Default. + public static DeleteOrUpdateBehavior Default { get; } = new DeleteOrUpdateBehavior(DefaultValue); + /// ForcedCleanup. + public static DeleteOrUpdateBehavior ForcedCleanup { get; } = new DeleteOrUpdateBehavior(ForcedCleanupValue); + /// Determines if two values are the same. + public static bool operator ==(DeleteOrUpdateBehavior left, DeleteOrUpdateBehavior right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DeleteOrUpdateBehavior left, DeleteOrUpdateBehavior right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DeleteOrUpdateBehavior(string value) => new DeleteOrUpdateBehavior(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DeleteOrUpdateBehavior other && Equals(other); + /// + public bool Equals(DeleteOrUpdateBehavior other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunActionName.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunActionName.cs new file mode 100644 index 000000000000..a3f40125d6a1 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunActionName.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.ServiceLinker.Models +{ + /// The name of action for you dryrun job. + internal readonly partial struct DryrunActionName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DryrunActionName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CreateOrUpdateValue = "createOrUpdate"; + + /// createOrUpdate. + public static DryrunActionName CreateOrUpdate { get; } = new DryrunActionName(CreateOrUpdateValue); + /// Determines if two values are the same. + public static bool operator ==(DryrunActionName left, DryrunActionName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DryrunActionName left, DryrunActionName right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DryrunActionName(string value) => new DryrunActionName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DryrunActionName other && Equals(other); + /// + public bool Equals(DryrunActionName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunList.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunList.Serialization.cs new file mode 100644 index 000000000000..7ef70e78e3f1 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunList.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ServiceLinker; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + internal partial class DryrunList + { + internal static DryrunList DeserializeDryrunList(JsonElement element) + { + Optional nextLink = default; + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nextLink")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + nextLink = null; + continue; + } + nextLink = property.Value.GetString(); + continue; + } + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DryrunResourceData.DeserializeDryrunResourceData(item)); + } + value = array; + continue; + } + } + return new DryrunList(nextLink.Value, Optional.ToList(value)); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunList.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunList.cs new file mode 100644 index 000000000000..2b4b3b647dd3 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunList.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ServiceLinker; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The list of dryrun. + internal partial class DryrunList + { + /// Initializes a new instance of DryrunList. + internal DryrunList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DryrunList. + /// The link used to get the next page of dryrun list. + /// The list of dryrun. + internal DryrunList(string nextLink, IReadOnlyList value) + { + NextLink = nextLink; + Value = value; + } + + /// The link used to get the next page of dryrun list. + public string NextLink { get; } + /// The list of dryrun. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunOperationPreview.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunOperationPreview.Serialization.cs new file mode 100644 index 000000000000..fa863d9ce3cf --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunOperationPreview.Serialization.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class DryrunOperationPreview + { + internal static DryrunOperationPreview DeserializeDryrunOperationPreview(JsonElement element) + { + Optional name = default; + Optional operationType = default; + Optional description = default; + Optional action = default; + Optional scope = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("operationType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + operationType = new DryrunPreviewOperationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("description")) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("action")) + { + action = property.Value.GetString(); + continue; + } + if (property.NameEquals("scope")) + { + scope = property.Value.GetString(); + continue; + } + } + return new DryrunOperationPreview(name.Value, Optional.ToNullable(operationType), description.Value, action.Value, scope.Value); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunOperationPreview.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunOperationPreview.cs new file mode 100644 index 000000000000..e8f640647be5 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunOperationPreview.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The preview of the operations for creation. + public partial class DryrunOperationPreview + { + /// Initializes a new instance of DryrunOperationPreview. + internal DryrunOperationPreview() + { + } + + /// Initializes a new instance of DryrunOperationPreview. + /// The operation name. + /// The operation type. + /// The description of the operation. + /// The action defined by RBAC, refer https://docs.microsoft.com/azure/role-based-access-control/role-definitions#actions-format. + /// The scope of the operation, refer https://docs.microsoft.com/azure/role-based-access-control/scope-overview. + internal DryrunOperationPreview(string name, DryrunPreviewOperationType? operationType, string description, string action, string scope) + { + Name = name; + OperationType = operationType; + Description = description; + Action = action; + Scope = scope; + } + + /// The operation name. + public string Name { get; } + /// The operation type. + public DryrunPreviewOperationType? OperationType { get; } + /// The description of the operation. + public string Description { get; } + /// The action defined by RBAC, refer https://docs.microsoft.com/azure/role-based-access-control/role-definitions#actions-format. + public string Action { get; } + /// The scope of the operation, refer https://docs.microsoft.com/azure/role-based-access-control/scope-overview. + public string Scope { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunParameters.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunParameters.Serialization.cs new file mode 100644 index 000000000000..ce9ced261d49 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunParameters.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class DryrunParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("actionName"); + writer.WriteStringValue(ActionName.ToString()); + writer.WriteEndObject(); + } + + internal static DryrunParameters DeserializeDryrunParameters(JsonElement element) + { + if (element.TryGetProperty("actionName", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "createOrUpdate": return CreateOrUpdateDryrunParameters.DeserializeCreateOrUpdateDryrunParameters(element); + } + } + return UnknownDryrunParameters.DeserializeUnknownDryrunParameters(element); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunParameters.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunParameters.cs new file mode 100644 index 000000000000..d31426e38090 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunParameters.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// + /// The parameters of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public abstract partial class DryrunParameters + { + /// Initializes a new instance of DryrunParameters. + protected DryrunParameters() + { + } + + /// Initializes a new instance of DryrunParameters. + /// The name of action for you dryrun job. + internal DryrunParameters(DryrunActionName actionName) + { + ActionName = actionName; + } + + /// The name of action for you dryrun job. + internal DryrunActionName ActionName { get; set; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPatch.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPatch.Serialization.cs new file mode 100644 index 000000000000..04e46df6f054 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPatch.Serialization.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class DryrunPatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(Parameters)) + { + writer.WritePropertyName("parameters"); + writer.WriteObjectValue(Parameters); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPatch.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPatch.cs new file mode 100644 index 000000000000..00936834469d --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPatch.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// a dryrun job to be updated. + public partial class DryrunPatch + { + /// Initializes a new instance of DryrunPatch. + public DryrunPatch() + { + PrerequisiteResults = new ChangeTrackingList(); + OperationPreviews = new ChangeTrackingList(); + } + + /// + /// The parameters of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public DryrunParameters Parameters { get; set; } + /// + /// the result of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public IReadOnlyList PrerequisiteResults { get; } + /// the preview of the operations for creation. + public IReadOnlyList OperationPreviews { get; } + /// The provisioning state. + public string ProvisioningState { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResult.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResult.Serialization.cs new file mode 100644 index 000000000000..80bd863a1055 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResult.Serialization.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class DryrunPrerequisiteResult + { + internal static DryrunPrerequisiteResult DeserializeDryrunPrerequisiteResult(JsonElement element) + { + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "basicError": return BasicErrorDryrunPrerequisiteResult.DeserializeBasicErrorDryrunPrerequisiteResult(element); + case "permissionsMissing": return PermissionsMissingDryrunPrerequisiteResult.DeserializePermissionsMissingDryrunPrerequisiteResult(element); + } + } + return UnknownDryrunPrerequisiteResult.DeserializeUnknownDryrunPrerequisiteResult(element); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResult.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResult.cs new file mode 100644 index 000000000000..c18de289db8f --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// + /// A result of dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class DryrunPrerequisiteResult + { + /// Initializes a new instance of DryrunPrerequisiteResult. + protected DryrunPrerequisiteResult() + { + } + + /// Initializes a new instance of DryrunPrerequisiteResult. + /// The type of dryrun result. + internal DryrunPrerequisiteResult(DryrunPrerequisiteResultType resultType) + { + ResultType = resultType; + } + + /// The type of dryrun result. + internal DryrunPrerequisiteResultType ResultType { get; set; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResultType.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResultType.cs new file mode 100644 index 000000000000..f4e086707e78 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResultType.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.ServiceLinker.Models +{ + /// The type of dryrun result. + internal readonly partial struct DryrunPrerequisiteResultType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DryrunPrerequisiteResultType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string BasicErrorValue = "basicError"; + private const string PermissionsMissingValue = "permissionsMissing"; + + /// basicError. + public static DryrunPrerequisiteResultType BasicError { get; } = new DryrunPrerequisiteResultType(BasicErrorValue); + /// permissionsMissing. + public static DryrunPrerequisiteResultType PermissionsMissing { get; } = new DryrunPrerequisiteResultType(PermissionsMissingValue); + /// Determines if two values are the same. + public static bool operator ==(DryrunPrerequisiteResultType left, DryrunPrerequisiteResultType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DryrunPrerequisiteResultType left, DryrunPrerequisiteResultType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DryrunPrerequisiteResultType(string value) => new DryrunPrerequisiteResultType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DryrunPrerequisiteResultType other && Equals(other); + /// + public bool Equals(DryrunPrerequisiteResultType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPreviewOperationType.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPreviewOperationType.cs new file mode 100644 index 000000000000..f0cd3d5e88d6 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPreviewOperationType.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.ServiceLinker.Models +{ + /// The operation type. + public readonly partial struct DryrunPreviewOperationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DryrunPreviewOperationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ConfigConnectionValue = "configConnection"; + private const string ConfigNetworkValue = "configNetwork"; + private const string ConfigAuthValue = "configAuth"; + + /// configConnection. + public static DryrunPreviewOperationType ConfigConnection { get; } = new DryrunPreviewOperationType(ConfigConnectionValue); + /// configNetwork. + public static DryrunPreviewOperationType ConfigNetwork { get; } = new DryrunPreviewOperationType(ConfigNetworkValue); + /// configAuth. + public static DryrunPreviewOperationType ConfigAuth { get; } = new DryrunPreviewOperationType(ConfigAuthValue); + /// Determines if two values are the same. + public static bool operator ==(DryrunPreviewOperationType left, DryrunPreviewOperationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DryrunPreviewOperationType left, DryrunPreviewOperationType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DryrunPreviewOperationType(string value) => new DryrunPreviewOperationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DryrunPreviewOperationType other && Equals(other); + /// + public bool Equals(DryrunPreviewOperationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunResourceData.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunResourceData.Serialization.cs new file mode 100644 index 000000000000..10ec575b7290 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunResourceData.Serialization.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker +{ + public partial class DryrunResourceData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(Parameters)) + { + writer.WritePropertyName("parameters"); + writer.WriteObjectValue(Parameters); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static DryrunResourceData DeserializeDryrunResourceData(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional parameters = default; + Optional> prerequisiteResults = default; + Optional> operationPreviews = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("parameters")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + parameters = DryrunParameters.DeserializeDryrunParameters(property0.Value); + continue; + } + if (property0.NameEquals("prerequisiteResults")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(DryrunPrerequisiteResult.DeserializeDryrunPrerequisiteResult(item)); + } + prerequisiteResults = array; + continue; + } + if (property0.NameEquals("operationPreviews")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(DryrunOperationPreview.DeserializeDryrunOperationPreview(item)); + } + operationPreviews = array; + continue; + } + if (property0.NameEquals("provisioningState")) + { + provisioningState = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new DryrunResourceData(id, name, type, systemData.Value, parameters.Value, Optional.ToList(prerequisiteResults), Optional.ToList(operationPreviews), provisioningState.Value); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/FirewallRules.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/FirewallRules.Serialization.cs new file mode 100644 index 000000000000..e4af0e93a0ae --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/FirewallRules.Serialization.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class FirewallRules : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(IPRanges)) + { + writer.WritePropertyName("ipRanges"); + writer.WriteStartArray(); + foreach (var item in IPRanges) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(AzureServices)) + { + writer.WritePropertyName("azureServices"); + writer.WriteStringValue(AzureServices.Value.ToString()); + } + if (Optional.IsDefined(CallerClientIP)) + { + writer.WritePropertyName("callerClientIP"); + writer.WriteStringValue(CallerClientIP.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static FirewallRules DeserializeFirewallRules(JsonElement element) + { + Optional> ipRanges = default; + Optional azureServices = default; + Optional callerClientIP = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ipRanges")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + ipRanges = array; + continue; + } + if (property.NameEquals("azureServices")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + azureServices = new AllowType(property.Value.GetString()); + continue; + } + if (property.NameEquals("callerClientIP")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + callerClientIP = new AllowType(property.Value.GetString()); + continue; + } + } + return new FirewallRules(Optional.ToList(ipRanges), Optional.ToNullable(azureServices), Optional.ToNullable(callerClientIP)); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/FirewallRules.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/FirewallRules.cs new file mode 100644 index 000000000000..8637d9e74d89 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/FirewallRules.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Target service's firewall rules. to allow connections from source service. + public partial class FirewallRules + { + /// Initializes a new instance of FirewallRules. + public FirewallRules() + { + IPRanges = new ChangeTrackingList(); + } + + /// Initializes a new instance of FirewallRules. + /// This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. + /// Allow Azure services to access the target service if true. + /// Allow caller client IP to access the target service if true. the property is used when connecting local application to target service. + internal FirewallRules(IList ipRanges, AllowType? azureServices, AllowType? callerClientIP) + { + IPRanges = ipRanges; + AzureServices = azureServices; + CallerClientIP = callerClientIP; + } + + /// This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. + public IList IPRanges { get; } + /// Allow Azure services to access the target service if true. + public AllowType? AzureServices { get; set; } + /// Allow caller client IP to access the target service if true. the property is used when connecting local application to target service. + public AllowType? CallerClientIP { get; set; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerAuthType.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerAuthType.cs index 3a51fc6d3dfb..28c2baa4fcf3 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerAuthType.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerAuthType.cs @@ -27,6 +27,8 @@ public LinkerAuthType(string value) private const string ServicePrincipalSecretValue = "servicePrincipalSecret"; private const string ServicePrincipalCertificateValue = "servicePrincipalCertificate"; private const string SecretValue = "secret"; + private const string AccessKeyValue = "accessKey"; + private const string UserAccountValue = "userAccount"; /// systemAssignedIdentity. public static LinkerAuthType SystemAssignedIdentity { get; } = new LinkerAuthType(SystemAssignedIdentityValue); @@ -38,6 +40,10 @@ public LinkerAuthType(string value) public static LinkerAuthType ServicePrincipalCertificate { get; } = new LinkerAuthType(ServicePrincipalCertificateValue); /// secret. public static LinkerAuthType Secret { get; } = new LinkerAuthType(SecretValue); + /// accessKey. + public static LinkerAuthType AccessKey { get; } = new LinkerAuthType(AccessKeyValue); + /// userAccount. + public static LinkerAuthType UserAccount { get; } = new LinkerAuthType(UserAccountValue); /// Determines if two values are the same. public static bool operator ==(LinkerAuthType left, LinkerAuthType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerClientType.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerClientType.cs index ddc43894541f..0eb06984d2c9 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerClientType.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerClientType.cs @@ -32,6 +32,7 @@ public LinkerClientType(string value) private const string DjangoValue = "django"; private const string NodejsValue = "nodejs"; private const string SpringBootValue = "springBoot"; + private const string KafkaSpringBootValue = "kafka-springBoot"; /// none. public static LinkerClientType None { get; } = new LinkerClientType(NoneValue); @@ -53,6 +54,8 @@ public LinkerClientType(string value) public static LinkerClientType Nodejs { get; } = new LinkerClientType(NodejsValue); /// springBoot. public static LinkerClientType SpringBoot { get; } = new LinkerClientType(SpringBootValue); + /// kafka-springBoot. + public static LinkerClientType KafkaSpringBoot { get; } = new LinkerClientType(KafkaSpringBootValue); /// Determines if two values are the same. public static bool operator ==(LinkerClientType left, LinkerClientType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourcePatch.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerPatch.Serialization.cs similarity index 71% rename from sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourcePatch.Serialization.cs rename to sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerPatch.Serialization.cs index 6594e4e0225d..413a3ed2945c 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourcePatch.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerPatch.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - public partial class LinkerResourcePatch : IUtf8JsonSerializable + public partial class LinkerPatch : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -68,6 +68,30 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("scope"); } } + if (Optional.IsDefined(PublicNetworkSolution)) + { + if (PublicNetworkSolution != null) + { + writer.WritePropertyName("publicNetworkSolution"); + writer.WriteObjectValue(PublicNetworkSolution); + } + else + { + writer.WriteNull("publicNetworkSolution"); + } + } + if (Optional.IsDefined(ConfigurationInfo)) + { + if (ConfigurationInfo != null) + { + writer.WritePropertyName("configurationInfo"); + writer.WriteObjectValue(ConfigurationInfo); + } + else + { + writer.WriteNull("configurationInfo"); + } + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerPatch.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerPatch.cs new file mode 100644 index 000000000000..2f0fc344630c --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerPatch.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// A Linker to be updated. + public partial class LinkerPatch + { + /// Initializes a new instance of LinkerPatch. + public LinkerPatch() + { + } + + /// + /// The target service properties + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , and . + /// + public TargetServiceBaseInfo TargetService { get; set; } + /// + /// The authentication type. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , and . + /// + public AuthBaseInfo AuthInfo { get; set; } + /// The application client type. + public LinkerClientType? ClientType { get; set; } + /// The provisioning state. + public string ProvisioningState { get; } + /// The VNet solution. + public VnetSolution VnetSolution { get; set; } + /// An option to store secret value in secure place. + public LinkerSecretStore SecretStore { get; set; } + /// connection scope in source service. + public string Scope { get; set; } + /// The network solution. + public PublicNetworkSolution PublicNetworkSolution { get; set; } + /// The connection information consumed by applications, including secrets, connection strings. + public ConfigurationInfo ConfigurationInfo { get; set; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourceData.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourceData.Serialization.cs index 29dd4a1c4b75..1e90c06f51a2 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourceData.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourceData.Serialization.cs @@ -70,6 +70,30 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("scope"); } } + if (Optional.IsDefined(PublicNetworkSolution)) + { + if (PublicNetworkSolution != null) + { + writer.WritePropertyName("publicNetworkSolution"); + writer.WriteObjectValue(PublicNetworkSolution); + } + else + { + writer.WriteNull("publicNetworkSolution"); + } + } + if (Optional.IsDefined(ConfigurationInfo)) + { + if (ConfigurationInfo != null) + { + writer.WritePropertyName("configurationInfo"); + writer.WriteObjectValue(ConfigurationInfo); + } + else + { + writer.WriteNull("configurationInfo"); + } + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -87,6 +111,8 @@ internal static LinkerResourceData DeserializeLinkerResourceData(JsonElement ele Optional vnetSolution = default; Optional secretStore = default; Optional scope = default; + Optional publicNetworkSolution = default; + Optional configurationInfo = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -188,11 +214,31 @@ internal static LinkerResourceData DeserializeLinkerResourceData(JsonElement ele scope = property0.Value.GetString(); continue; } + if (property0.NameEquals("publicNetworkSolution")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + publicNetworkSolution = null; + continue; + } + publicNetworkSolution = PublicNetworkSolution.DeserializePublicNetworkSolution(property0.Value); + continue; + } + if (property0.NameEquals("configurationInfo")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + configurationInfo = null; + continue; + } + configurationInfo = ConfigurationInfo.DeserializeConfigurationInfo(property0.Value); + continue; + } } continue; } } - return new LinkerResourceData(id, name, type, systemData.Value, targetService.Value, authInfo.Value, Optional.ToNullable(clientType), provisioningState.Value, vnetSolution.Value, secretStore.Value, scope.Value); + return new LinkerResourceData(id, name, type, systemData.Value, targetService.Value, authInfo.Value, Optional.ToNullable(clientType), provisioningState.Value, vnetSolution.Value, secretStore.Value, scope.Value, publicNetworkSolution.Value, configurationInfo.Value); } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourcePatch.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourcePatch.cs deleted file mode 100644 index e5936827dbb5..000000000000 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourcePatch.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; - -namespace Azure.ResourceManager.ServiceLinker.Models -{ - /// A linker to be updated. - public partial class LinkerResourcePatch - { - /// Initializes a new instance of LinkerResourcePatch. - public LinkerResourcePatch() - { - } - - /// - /// The target service properties - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . - /// - public TargetServiceBaseInfo TargetService { get; set; } - /// - /// The authentication type. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . - /// - public AuthBaseInfo AuthInfo { get; set; } - /// The application client type. - public LinkerClientType? ClientType { get; set; } - /// The provisioning state. - public string ProvisioningState { get; } - /// The VNet solution. - internal VnetSolution VnetSolution { get; set; } - /// Type of VNet solution. - public VnetSolutionType? SolutionType - { - get => VnetSolution is null ? default : VnetSolution.SolutionType; - set - { - if (VnetSolution is null) - VnetSolution = new VnetSolution(); - VnetSolution.SolutionType = value; - } - } - - /// An option to store secret value in secure place. - internal LinkerSecretStore SecretStore { get; set; } - /// The key vault id to store secret. - public ResourceIdentifier SecretStoreKeyVaultId - { - get => SecretStore is null ? default : SecretStore.KeyVaultId; - set - { - if (SecretStore is null) - SecretStore = new LinkerSecretStore(); - SecretStore.KeyVaultId = value; - } - } - - /// connection scope in source service. - public string Scope { get; set; } - } -} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerSecretStore.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerSecretStore.Serialization.cs index 2211b467d236..d5b42cd3a56c 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerSecretStore.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerSecretStore.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - internal partial class LinkerSecretStore : IUtf8JsonSerializable + public partial class LinkerSecretStore : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -27,12 +27,25 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("keyVaultId"); } } + if (Optional.IsDefined(KeyVaultSecretName)) + { + if (KeyVaultSecretName != null) + { + writer.WritePropertyName("keyVaultSecretName"); + writer.WriteStringValue(KeyVaultSecretName); + } + else + { + writer.WriteNull("keyVaultSecretName"); + } + } writer.WriteEndObject(); } internal static LinkerSecretStore DeserializeLinkerSecretStore(JsonElement element) { Optional keyVaultId = default; + Optional keyVaultSecretName = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyVaultId")) @@ -45,8 +58,18 @@ internal static LinkerSecretStore DeserializeLinkerSecretStore(JsonElement eleme keyVaultId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (property.NameEquals("keyVaultSecretName")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + keyVaultSecretName = null; + continue; + } + keyVaultSecretName = property.Value.GetString(); + continue; + } } - return new LinkerSecretStore(keyVaultId.Value); + return new LinkerSecretStore(keyVaultId.Value, keyVaultSecretName.Value); } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerSecretStore.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerSecretStore.cs index 073ae9ae1f2f..d2a9accb1417 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerSecretStore.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerSecretStore.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { /// An option to store secret value in secure place. - internal partial class LinkerSecretStore + public partial class LinkerSecretStore { /// Initializes a new instance of LinkerSecretStore. public LinkerSecretStore() @@ -19,12 +19,16 @@ public LinkerSecretStore() /// Initializes a new instance of LinkerSecretStore. /// The key vault id to store secret. - internal LinkerSecretStore(ResourceIdentifier keyVaultId) + /// The key vault secret name to store secret, only valid when storing one secret. + internal LinkerSecretStore(ResourceIdentifier keyVaultId, string keyVaultSecretName) { KeyVaultId = keyVaultId; + KeyVaultSecretName = keyVaultSecretName; } /// The key vault id to store secret. public ResourceIdentifier KeyVaultId { get; set; } + /// The key vault secret name to store secret, only valid when storing one secret. + public string KeyVaultSecretName { get; set; } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerValidateOperationResult.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerValidateOperationResult.cs index 95f57de14b2d..4609ba4f8eff 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerValidateOperationResult.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerValidateOperationResult.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - /// The validation operation result for a linker. + /// The validation operation result for a Linker. public partial class LinkerValidateOperationResult { /// Initializes a new instance of LinkerValidateOperationResult. @@ -21,13 +21,13 @@ internal LinkerValidateOperationResult() } /// Initializes a new instance of LinkerValidateOperationResult. - /// Validated linker id. + /// Validated Linker id. /// Validation operation status. /// The linker name. /// A boolean value indicating whether the connection is available or not. /// The start time of the validation report. /// The end time of the validation report. - /// The resource id of the linker source application. + /// The resource id of the Linker source application. /// The resource Id of target service. /// The authentication type. /// The detail of validation result. @@ -45,7 +45,7 @@ internal LinkerValidateOperationResult(ResourceIdentifier resourceId, string sta ValidationDetail = validationDetail; } - /// Validated linker id. + /// Validated Linker id. public ResourceIdentifier ResourceId { get; } /// Validation operation status. public string Status { get; } @@ -57,7 +57,7 @@ internal LinkerValidateOperationResult(ResourceIdentifier resourceId, string sta public DateTimeOffset? ReportStartOn { get; } /// The end time of the validation report. public DateTimeOffset? ReportEndOn { get; } - /// The resource id of the linker source application. + /// The resource id of the Linker source application. public ResourceIdentifier SourceId { get; } /// The resource Id of target service. public ResourceIdentifier TargetId { get; } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerValidationResultItemInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerValidationResultItemInfo.cs index 1c11354019eb..7c6c7244755e 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerValidationResultItemInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerValidationResultItemInfo.cs @@ -7,7 +7,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - /// The validation item for a linker. + /// The validation item for a Linker. public partial class LinkerValidationResultItemInfo { /// Initializes a new instance of LinkerValidationResultItemInfo. diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PermissionsMissingDryrunPrerequisiteResult.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PermissionsMissingDryrunPrerequisiteResult.Serialization.cs new file mode 100644 index 000000000000..3c8c8bbd1465 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PermissionsMissingDryrunPrerequisiteResult.Serialization.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class PermissionsMissingDryrunPrerequisiteResult + { + internal static PermissionsMissingDryrunPrerequisiteResult DeserializePermissionsMissingDryrunPrerequisiteResult(JsonElement element) + { + Optional scope = default; + Optional> permissions = default; + Optional recommendedRole = default; + DryrunPrerequisiteResultType type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("scope")) + { + scope = property.Value.GetString(); + continue; + } + if (property.NameEquals("permissions")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + permissions = array; + continue; + } + if (property.NameEquals("recommendedRole")) + { + recommendedRole = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = new DryrunPrerequisiteResultType(property.Value.GetString()); + continue; + } + } + return new PermissionsMissingDryrunPrerequisiteResult(type, scope.Value, Optional.ToList(permissions), recommendedRole.Value); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PermissionsMissingDryrunPrerequisiteResult.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PermissionsMissingDryrunPrerequisiteResult.cs new file mode 100644 index 000000000000..91fd6b719bbb --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PermissionsMissingDryrunPrerequisiteResult.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The represent of missing permissions. + public partial class PermissionsMissingDryrunPrerequisiteResult : DryrunPrerequisiteResult + { + /// Initializes a new instance of PermissionsMissingDryrunPrerequisiteResult. + internal PermissionsMissingDryrunPrerequisiteResult() + { + Permissions = new ChangeTrackingList(); + ResultType = DryrunPrerequisiteResultType.PermissionsMissing; + } + + /// Initializes a new instance of PermissionsMissingDryrunPrerequisiteResult. + /// The type of dryrun result. + /// The permission scope. + /// The permission list. + /// The recommended role to resolve permissions missing. + internal PermissionsMissingDryrunPrerequisiteResult(DryrunPrerequisiteResultType resultType, string scope, IReadOnlyList permissions, string recommendedRole) : base(resultType) + { + Scope = scope; + Permissions = permissions; + RecommendedRole = recommendedRole; + ResultType = resultType; + } + + /// The permission scope. + public string Scope { get; } + /// The permission list. + public IReadOnlyList Permissions { get; } + /// The recommended role to resolve permissions missing. + public string RecommendedRole { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PublicNetworkSolution.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PublicNetworkSolution.Serialization.cs new file mode 100644 index 000000000000..3b918d7c39c3 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PublicNetworkSolution.Serialization.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class PublicNetworkSolution : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(DeleteOrUpdateBehavior)) + { + writer.WritePropertyName("deleteOrUpdateBehavior"); + writer.WriteStringValue(DeleteOrUpdateBehavior.Value.ToString()); + } + if (Optional.IsDefined(Action)) + { + writer.WritePropertyName("action"); + writer.WriteStringValue(Action.Value.ToString()); + } + if (Optional.IsDefined(FirewallRules)) + { + writer.WritePropertyName("firewallRules"); + writer.WriteObjectValue(FirewallRules); + } + writer.WriteEndObject(); + } + + internal static PublicNetworkSolution DeserializePublicNetworkSolution(JsonElement element) + { + Optional deleteOrUpdateBehavior = default; + Optional action = default; + Optional firewallRules = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("deleteOrUpdateBehavior")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + deleteOrUpdateBehavior = new DeleteOrUpdateBehavior(property.Value.GetString()); + continue; + } + if (property.NameEquals("action")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + action = new ActionType(property.Value.GetString()); + continue; + } + if (property.NameEquals("firewallRules")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + firewallRules = FirewallRules.DeserializeFirewallRules(property.Value); + continue; + } + } + return new PublicNetworkSolution(Optional.ToNullable(deleteOrUpdateBehavior), Optional.ToNullable(action), firewallRules.Value); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PublicNetworkSolution.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PublicNetworkSolution.cs new file mode 100644 index 000000000000..db8eb64f0c05 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PublicNetworkSolution.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Indicates public network solution, include firewall rules. + public partial class PublicNetworkSolution + { + /// Initializes a new instance of PublicNetworkSolution. + public PublicNetworkSolution() + { + } + + /// Initializes a new instance of PublicNetworkSolution. + /// Indicates whether to clean up previous operation(such as firewall rules) when Linker is updating or deleting. + /// Optional. Indicates public network solution. If enable, enable public network access of target service with best try. Default is enable. If optOut, opt out public network access configuration. + /// Describe firewall rules of target service to make sure source application could connect to the target. + internal PublicNetworkSolution(DeleteOrUpdateBehavior? deleteOrUpdateBehavior, ActionType? action, FirewallRules firewallRules) + { + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + Action = action; + FirewallRules = firewallRules; + } + + /// Indicates whether to clean up previous operation(such as firewall rules) when Linker is updating or deleting. + public DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get; set; } + /// Optional. Indicates public network solution. If enable, enable public network access of target service with best try. Default is enable. If optOut, opt out public network access configuration. + public ActionType? Action { get; set; } + /// Describe firewall rules of target service to make sure source application could connect to the target. + public FirewallRules FirewallRules { get; set; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerList.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ResourceList.Serialization.cs similarity index 88% rename from sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerList.Serialization.cs rename to sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ResourceList.Serialization.cs index f6d2ebfcc13c..b266aa46e11c 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerList.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ResourceList.Serialization.cs @@ -12,9 +12,9 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - internal partial class LinkerList + internal partial class ResourceList { - internal static LinkerList DeserializeLinkerList(JsonElement element) + internal static ResourceList DeserializeResourceList(JsonElement element) { Optional nextLink = default; Optional> value = default; @@ -46,7 +46,7 @@ internal static LinkerList DeserializeLinkerList(JsonElement element) continue; } } - return new LinkerList(nextLink.Value, Optional.ToList(value)); + return new ResourceList(nextLink.Value, Optional.ToList(value)); } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerList.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ResourceList.cs similarity index 59% rename from sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerList.cs rename to sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ResourceList.cs index 4e843472b087..1097fa7f73bd 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerList.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ResourceList.cs @@ -12,24 +12,24 @@ namespace Azure.ResourceManager.ServiceLinker.Models { /// The list of Linker. - internal partial class LinkerList + internal partial class ResourceList { - /// Initializes a new instance of LinkerList. - internal LinkerList() + /// Initializes a new instance of ResourceList. + internal ResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of LinkerList. - /// The link used to get the next page of Linker list. + /// Initializes a new instance of ResourceList. + /// The Linker used to get the next page of Linker list. /// The list of Linkers. - internal LinkerList(string nextLink, IReadOnlyList value) + internal ResourceList(string nextLink, IReadOnlyList value) { NextLink = nextLink; Value = value; } - /// The link used to get the next page of Linker list. + /// The Linker used to get the next page of Linker list. public string NextLink { get; } /// The list of Linkers. public IReadOnlyList Value { get; } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SelfHostedServer.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SelfHostedServer.Serialization.cs new file mode 100644 index 000000000000..13e0d11e926e --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SelfHostedServer.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class SelfHostedServer : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Endpoint)) + { + writer.WritePropertyName("endpoint"); + writer.WriteStringValue(Endpoint); + } + writer.WritePropertyName("type"); + writer.WriteStringValue(TargetServiceType.ToString()); + writer.WriteEndObject(); + } + + internal static SelfHostedServer DeserializeSelfHostedServer(JsonElement element) + { + Optional endpoint = default; + TargetServiceType type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("endpoint")) + { + endpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = new TargetServiceType(property.Value.GetString()); + continue; + } + } + return new SelfHostedServer(type, endpoint.Value); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SelfHostedServer.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SelfHostedServer.cs new file mode 100644 index 000000000000..b80594013123 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SelfHostedServer.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The service properties when target service type is SelfHostedServer. + public partial class SelfHostedServer : TargetServiceBaseInfo + { + /// Initializes a new instance of SelfHostedServer. + public SelfHostedServer() + { + TargetServiceType = TargetServiceType.SelfHostedServer; + } + + /// Initializes a new instance of SelfHostedServer. + /// The target service type. + /// The endpoint of service. + internal SelfHostedServer(TargetServiceType targetServiceType, string endpoint) : base(targetServiceType) + { + Endpoint = endpoint; + TargetServiceType = targetServiceType; + } + + /// The endpoint of service. + public string Endpoint { get; set; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalCertificateAuthInfo.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalCertificateAuthInfo.Serialization.cs index 92c5b3c345a8..8135132500de 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalCertificateAuthInfo.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalCertificateAuthInfo.Serialization.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -22,6 +23,21 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(PrincipalId); writer.WritePropertyName("certificate"); writer.WriteStringValue(Certificate); + if (Optional.IsDefined(DeleteOrUpdateBehavior)) + { + writer.WritePropertyName("deleteOrUpdateBehavior"); + writer.WriteStringValue(DeleteOrUpdateBehavior.Value.ToString()); + } + if (Optional.IsCollectionDefined(Roles)) + { + writer.WritePropertyName("roles"); + writer.WriteStartArray(); + foreach (var item in Roles) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } writer.WritePropertyName("authType"); writer.WriteStringValue(AuthType.ToString()); writer.WriteEndObject(); @@ -32,6 +48,8 @@ internal static ServicePrincipalCertificateAuthInfo DeserializeServicePrincipalC string clientId = default; Guid principalId = default; string certificate = default; + Optional deleteOrUpdateBehavior = default; + Optional> roles = default; LinkerAuthType authType = default; foreach (var property in element.EnumerateObject()) { @@ -50,13 +68,38 @@ internal static ServicePrincipalCertificateAuthInfo DeserializeServicePrincipalC certificate = property.Value.GetString(); continue; } + if (property.NameEquals("deleteOrUpdateBehavior")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + deleteOrUpdateBehavior = new DeleteOrUpdateBehavior(property.Value.GetString()); + continue; + } + if (property.NameEquals("roles")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + roles = array; + continue; + } if (property.NameEquals("authType")) { authType = new LinkerAuthType(property.Value.GetString()); continue; } } - return new ServicePrincipalCertificateAuthInfo(authType, clientId, principalId, certificate); + return new ServicePrincipalCertificateAuthInfo(authType, clientId, principalId, certificate, Optional.ToNullable(deleteOrUpdateBehavior), Optional.ToList(roles)); } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalCertificateAuthInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalCertificateAuthInfo.cs index b63d6738afaf..53ec841dd349 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalCertificateAuthInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalCertificateAuthInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ServiceLinker.Models @@ -26,6 +27,7 @@ public ServicePrincipalCertificateAuthInfo(string clientId, Guid principalId, st ClientId = clientId; PrincipalId = principalId; Certificate = certificate; + Roles = new ChangeTrackingList(); AuthType = LinkerAuthType.ServicePrincipalCertificate; } @@ -34,11 +36,15 @@ public ServicePrincipalCertificateAuthInfo(string clientId, Guid principalId, st /// Application clientId for servicePrincipal auth. /// Principal Id for servicePrincipal auth. /// ServicePrincipal certificate for servicePrincipal auth. - internal ServicePrincipalCertificateAuthInfo(LinkerAuthType authType, string clientId, Guid principalId, string certificate) : base(authType) + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + /// Optional, this value specifies the Azure roles to be assigned. Automatically. + internal ServicePrincipalCertificateAuthInfo(LinkerAuthType authType, string clientId, Guid principalId, string certificate, DeleteOrUpdateBehavior? deleteOrUpdateBehavior, IList roles) : base(authType) { ClientId = clientId; PrincipalId = principalId; Certificate = certificate; + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + Roles = roles; AuthType = authType; } @@ -48,5 +54,9 @@ internal ServicePrincipalCertificateAuthInfo(LinkerAuthType authType, string cli public Guid PrincipalId { get; set; } /// ServicePrincipal certificate for servicePrincipal auth. public string Certificate { get; set; } + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + public DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get; set; } + /// Optional, this value specifies the Azure roles to be assigned. Automatically. + public IList Roles { get; } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalSecretAuthInfo.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalSecretAuthInfo.Serialization.cs index c8223103ec47..9265f3be9043 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalSecretAuthInfo.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalSecretAuthInfo.Serialization.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -22,6 +23,33 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(PrincipalId); writer.WritePropertyName("secret"); writer.WriteStringValue(Secret); + if (Optional.IsDefined(DeleteOrUpdateBehavior)) + { + writer.WritePropertyName("deleteOrUpdateBehavior"); + writer.WriteStringValue(DeleteOrUpdateBehavior.Value.ToString()); + } + if (Optional.IsCollectionDefined(Roles)) + { + writer.WritePropertyName("roles"); + writer.WriteStartArray(); + foreach (var item in Roles) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(UserName)) + { + if (UserName != null) + { + writer.WritePropertyName("userName"); + writer.WriteStringValue(UserName); + } + else + { + writer.WriteNull("userName"); + } + } writer.WritePropertyName("authType"); writer.WriteStringValue(AuthType.ToString()); writer.WriteEndObject(); @@ -32,6 +60,9 @@ internal static ServicePrincipalSecretAuthInfo DeserializeServicePrincipalSecret string clientId = default; Guid principalId = default; string secret = default; + Optional deleteOrUpdateBehavior = default; + Optional> roles = default; + Optional userName = default; LinkerAuthType authType = default; foreach (var property in element.EnumerateObject()) { @@ -50,13 +81,48 @@ internal static ServicePrincipalSecretAuthInfo DeserializeServicePrincipalSecret secret = property.Value.GetString(); continue; } + if (property.NameEquals("deleteOrUpdateBehavior")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + deleteOrUpdateBehavior = new DeleteOrUpdateBehavior(property.Value.GetString()); + continue; + } + if (property.NameEquals("roles")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + roles = array; + continue; + } + if (property.NameEquals("userName")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + userName = null; + continue; + } + userName = property.Value.GetString(); + continue; + } if (property.NameEquals("authType")) { authType = new LinkerAuthType(property.Value.GetString()); continue; } } - return new ServicePrincipalSecretAuthInfo(authType, clientId, principalId, secret); + return new ServicePrincipalSecretAuthInfo(authType, clientId, principalId, secret, Optional.ToNullable(deleteOrUpdateBehavior), Optional.ToList(roles), userName.Value); } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalSecretAuthInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalSecretAuthInfo.cs index 8063a0fc111c..63c9a193c313 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalSecretAuthInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalSecretAuthInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ServiceLinker.Models @@ -26,6 +27,7 @@ public ServicePrincipalSecretAuthInfo(string clientId, Guid principalId, string ClientId = clientId; PrincipalId = principalId; Secret = secret; + Roles = new ChangeTrackingList(); AuthType = LinkerAuthType.ServicePrincipalSecret; } @@ -34,11 +36,17 @@ public ServicePrincipalSecretAuthInfo(string clientId, Guid principalId, string /// ServicePrincipal application clientId for servicePrincipal auth. /// Principal Id for servicePrincipal auth. /// Secret for servicePrincipal auth. - internal ServicePrincipalSecretAuthInfo(LinkerAuthType authType, string clientId, Guid principalId, string secret) : base(authType) + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + /// Optional, this value specifies the Azure roles to be assigned. Automatically. + /// Username created in the database which is mapped to a user in AAD. + internal ServicePrincipalSecretAuthInfo(LinkerAuthType authType, string clientId, Guid principalId, string secret, DeleteOrUpdateBehavior? deleteOrUpdateBehavior, IList roles, string userName) : base(authType) { ClientId = clientId; PrincipalId = principalId; Secret = secret; + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + Roles = roles; + UserName = userName; AuthType = authType; } @@ -48,5 +56,11 @@ internal ServicePrincipalSecretAuthInfo(LinkerAuthType authType, string clientId public Guid PrincipalId { get; set; } /// Secret for servicePrincipal auth. public string Secret { get; set; } + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + public DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get; set; } + /// Optional, this value specifies the Azure roles to be assigned. Automatically. + public IList Roles { get; } + /// Username created in the database which is mapped to a user in AAD. + public string UserName { get; set; } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SystemAssignedIdentityAuthInfo.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SystemAssignedIdentityAuthInfo.Serialization.cs index 2c02787f85cb..ce7aac0b3eb5 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SystemAssignedIdentityAuthInfo.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SystemAssignedIdentityAuthInfo.Serialization.cs @@ -5,6 +5,7 @@ #nullable disable +using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -15,6 +16,33 @@ public partial class SystemAssignedIdentityAuthInfo : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(DeleteOrUpdateBehavior)) + { + writer.WritePropertyName("deleteOrUpdateBehavior"); + writer.WriteStringValue(DeleteOrUpdateBehavior.Value.ToString()); + } + if (Optional.IsCollectionDefined(Roles)) + { + writer.WritePropertyName("roles"); + writer.WriteStartArray(); + foreach (var item in Roles) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(UserName)) + { + if (UserName != null) + { + writer.WritePropertyName("userName"); + writer.WriteStringValue(UserName); + } + else + { + writer.WriteNull("userName"); + } + } writer.WritePropertyName("authType"); writer.WriteStringValue(AuthType.ToString()); writer.WriteEndObject(); @@ -22,16 +50,54 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static SystemAssignedIdentityAuthInfo DeserializeSystemAssignedIdentityAuthInfo(JsonElement element) { + Optional deleteOrUpdateBehavior = default; + Optional> roles = default; + Optional userName = default; LinkerAuthType authType = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("deleteOrUpdateBehavior")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + deleteOrUpdateBehavior = new DeleteOrUpdateBehavior(property.Value.GetString()); + continue; + } + if (property.NameEquals("roles")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + roles = array; + continue; + } + if (property.NameEquals("userName")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + userName = null; + continue; + } + userName = property.Value.GetString(); + continue; + } if (property.NameEquals("authType")) { authType = new LinkerAuthType(property.Value.GetString()); continue; } } - return new SystemAssignedIdentityAuthInfo(authType); + return new SystemAssignedIdentityAuthInfo(authType, Optional.ToNullable(deleteOrUpdateBehavior), Optional.ToList(roles), userName.Value); } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SystemAssignedIdentityAuthInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SystemAssignedIdentityAuthInfo.cs index 3a457f39f30f..8efa79878cbb 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SystemAssignedIdentityAuthInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SystemAssignedIdentityAuthInfo.cs @@ -5,6 +5,9 @@ #nullable disable +using System.Collections.Generic; +using Azure.Core; + namespace Azure.ResourceManager.ServiceLinker.Models { /// The authentication info when authType is systemAssignedIdentity. @@ -13,14 +16,28 @@ public partial class SystemAssignedIdentityAuthInfo : AuthBaseInfo /// Initializes a new instance of SystemAssignedIdentityAuthInfo. public SystemAssignedIdentityAuthInfo() { + Roles = new ChangeTrackingList(); AuthType = LinkerAuthType.SystemAssignedIdentity; } /// Initializes a new instance of SystemAssignedIdentityAuthInfo. /// The authentication type. - internal SystemAssignedIdentityAuthInfo(LinkerAuthType authType) : base(authType) + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + /// Optional, this value specifies the Azure role to be assigned. + /// Username created in the database which is mapped to a user in AAD. + internal SystemAssignedIdentityAuthInfo(LinkerAuthType authType, DeleteOrUpdateBehavior? deleteOrUpdateBehavior, IList roles, string userName) : base(authType) { + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + Roles = roles; + UserName = userName; AuthType = authType; } + + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + public DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get; set; } + /// Optional, this value specifies the Azure role to be assigned. + public IList Roles { get; } + /// Username created in the database which is mapped to a user in AAD. + public string UserName { get; set; } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceBaseInfo.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceBaseInfo.Serialization.cs index a6e4ae2cbbc7..7d93cae00fc4 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceBaseInfo.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceBaseInfo.Serialization.cs @@ -29,6 +29,7 @@ internal static TargetServiceBaseInfo DeserializeTargetServiceBaseInfo(JsonEleme case "AzureResource": return AzureResourceInfo.DeserializeAzureResourceInfo(element); case "ConfluentBootstrapServer": return ConfluentBootstrapServerInfo.DeserializeConfluentBootstrapServerInfo(element); case "ConfluentSchemaRegistry": return ConfluentSchemaRegistryInfo.DeserializeConfluentSchemaRegistryInfo(element); + case "SelfHostedServer": return SelfHostedServer.DeserializeSelfHostedServer(element); } } return UnknownTargetServiceBase.DeserializeUnknownTargetServiceBase(element); diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceBaseInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceBaseInfo.cs index d76e3788322e..4dbc0f79d67d 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceBaseInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceBaseInfo.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models /// /// The target service properties /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . + /// The available derived classes include , , and . /// public abstract partial class TargetServiceBaseInfo { diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceType.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceType.cs index 3f4b6d0cc99d..bb5e2954cbf8 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceType.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceType.cs @@ -25,6 +25,7 @@ public TargetServiceType(string value) private const string AzureResourceValue = "AzureResource"; private const string ConfluentBootstrapServerValue = "ConfluentBootstrapServer"; private const string ConfluentSchemaRegistryValue = "ConfluentSchemaRegistry"; + private const string SelfHostedServerValue = "SelfHostedServer"; /// AzureResource. public static TargetServiceType AzureResource { get; } = new TargetServiceType(AzureResourceValue); @@ -32,6 +33,8 @@ public TargetServiceType(string value) public static TargetServiceType ConfluentBootstrapServer { get; } = new TargetServiceType(ConfluentBootstrapServerValue); /// ConfluentSchemaRegistry. public static TargetServiceType ConfluentSchemaRegistry { get; } = new TargetServiceType(ConfluentSchemaRegistryValue); + /// SelfHostedServer. + public static TargetServiceType SelfHostedServer { get; } = new TargetServiceType(SelfHostedServerValue); /// Determines if two values are the same. public static bool operator ==(TargetServiceType left, TargetServiceType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunParameters.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunParameters.Serialization.cs new file mode 100644 index 000000000000..f26f30126d07 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunParameters.Serialization.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + internal partial class UnknownDryrunParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("actionName"); + writer.WriteStringValue(ActionName.ToString()); + writer.WriteEndObject(); + } + + internal static UnknownDryrunParameters DeserializeUnknownDryrunParameters(JsonElement element) + { + DryrunActionName actionName = "Unknown"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("actionName")) + { + actionName = new DryrunActionName(property.Value.GetString()); + continue; + } + } + return new UnknownDryrunParameters(actionName); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunParameters.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunParameters.cs new file mode 100644 index 000000000000..a15fb94a8e67 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunParameters.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The UnknownDryrunParameters. + internal partial class UnknownDryrunParameters : DryrunParameters + { + /// Initializes a new instance of UnknownDryrunParameters. + /// The name of action for you dryrun job. + internal UnknownDryrunParameters(DryrunActionName actionName) : base(actionName) + { + ActionName = actionName; + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunPrerequisiteResult.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunPrerequisiteResult.Serialization.cs new file mode 100644 index 000000000000..95e91bdf7a37 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunPrerequisiteResult.Serialization.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + internal partial class UnknownDryrunPrerequisiteResult + { + internal static UnknownDryrunPrerequisiteResult DeserializeUnknownDryrunPrerequisiteResult(JsonElement element) + { + DryrunPrerequisiteResultType type = "Unknown"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type")) + { + type = new DryrunPrerequisiteResultType(property.Value.GetString()); + continue; + } + } + return new UnknownDryrunPrerequisiteResult(type); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunPrerequisiteResult.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunPrerequisiteResult.cs new file mode 100644 index 000000000000..8cb3181d500e --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunPrerequisiteResult.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The UnknownDryrunPrerequisiteResult. + internal partial class UnknownDryrunPrerequisiteResult : DryrunPrerequisiteResult + { + /// Initializes a new instance of UnknownDryrunPrerequisiteResult. + /// The type of dryrun result. + internal UnknownDryrunPrerequisiteResult(DryrunPrerequisiteResultType resultType) : base(resultType) + { + ResultType = resultType; + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAccountAuthInfo.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAccountAuthInfo.Serialization.cs new file mode 100644 index 000000000000..ff350dcdef2e --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAccountAuthInfo.Serialization.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class UserAccountAuthInfo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(PrincipalId)) + { + writer.WritePropertyName("principalId"); + writer.WriteStringValue(PrincipalId.Value); + } + if (Optional.IsDefined(DeleteOrUpdateBehavior)) + { + writer.WritePropertyName("deleteOrUpdateBehavior"); + writer.WriteStringValue(DeleteOrUpdateBehavior.Value.ToString()); + } + if (Optional.IsCollectionDefined(Roles)) + { + writer.WritePropertyName("roles"); + writer.WriteStartArray(); + foreach (var item in Roles) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(UserName)) + { + if (UserName != null) + { + writer.WritePropertyName("userName"); + writer.WriteStringValue(UserName); + } + else + { + writer.WriteNull("userName"); + } + } + writer.WritePropertyName("authType"); + writer.WriteStringValue(AuthType.ToString()); + writer.WriteEndObject(); + } + + internal static UserAccountAuthInfo DeserializeUserAccountAuthInfo(JsonElement element) + { + Optional principalId = default; + Optional deleteOrUpdateBehavior = default; + Optional> roles = default; + Optional userName = default; + LinkerAuthType authType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("principalId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + principalId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("deleteOrUpdateBehavior")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + deleteOrUpdateBehavior = new DeleteOrUpdateBehavior(property.Value.GetString()); + continue; + } + if (property.NameEquals("roles")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + roles = array; + continue; + } + if (property.NameEquals("userName")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + userName = null; + continue; + } + userName = property.Value.GetString(); + continue; + } + if (property.NameEquals("authType")) + { + authType = new LinkerAuthType(property.Value.GetString()); + continue; + } + } + return new UserAccountAuthInfo(authType, Optional.ToNullable(principalId), Optional.ToNullable(deleteOrUpdateBehavior), Optional.ToList(roles), userName.Value); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAccountAuthInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAccountAuthInfo.cs new file mode 100644 index 000000000000..fc00eaa2378e --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAccountAuthInfo.cs @@ -0,0 +1,48 @@ +// 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.ServiceLinker.Models +{ + /// The authentication info when authType is user account. + public partial class UserAccountAuthInfo : AuthBaseInfo + { + /// Initializes a new instance of UserAccountAuthInfo. + public UserAccountAuthInfo() + { + Roles = new ChangeTrackingList(); + AuthType = LinkerAuthType.UserAccount; + } + + /// Initializes a new instance of UserAccountAuthInfo. + /// The authentication type. + /// Principal Id for user account. + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + /// Optional, this value specifies the Azure roles to be assigned. Automatically. + /// Username created in the database which is mapped to a user in AAD. + internal UserAccountAuthInfo(LinkerAuthType authType, Guid? principalId, DeleteOrUpdateBehavior? deleteOrUpdateBehavior, IList roles, string userName) : base(authType) + { + PrincipalId = principalId; + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + Roles = roles; + UserName = userName; + AuthType = authType; + } + + /// Principal Id for user account. + public Guid? PrincipalId { get; set; } + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + public DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get; set; } + /// Optional, this value specifies the Azure roles to be assigned. Automatically. + public IList Roles { get; } + /// Username created in the database which is mapped to a user in AAD. + public string UserName { get; set; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAssignedIdentityAuthInfo.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAssignedIdentityAuthInfo.Serialization.cs index d6e4b59dca63..cf3150835787 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAssignedIdentityAuthInfo.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAssignedIdentityAuthInfo.Serialization.cs @@ -5,6 +5,7 @@ #nullable disable +using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -25,6 +26,33 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("subscriptionId"); writer.WriteStringValue(SubscriptionId); } + if (Optional.IsDefined(DeleteOrUpdateBehavior)) + { + writer.WritePropertyName("deleteOrUpdateBehavior"); + writer.WriteStringValue(DeleteOrUpdateBehavior.Value.ToString()); + } + if (Optional.IsCollectionDefined(Roles)) + { + writer.WritePropertyName("roles"); + writer.WriteStartArray(); + foreach (var item in Roles) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(UserName)) + { + if (UserName != null) + { + writer.WritePropertyName("userName"); + writer.WriteStringValue(UserName); + } + else + { + writer.WriteNull("userName"); + } + } writer.WritePropertyName("authType"); writer.WriteStringValue(AuthType.ToString()); writer.WriteEndObject(); @@ -34,6 +62,9 @@ internal static UserAssignedIdentityAuthInfo DeserializeUserAssignedIdentityAuth { Optional clientId = default; Optional subscriptionId = default; + Optional deleteOrUpdateBehavior = default; + Optional> roles = default; + Optional userName = default; LinkerAuthType authType = default; foreach (var property in element.EnumerateObject()) { @@ -47,13 +78,48 @@ internal static UserAssignedIdentityAuthInfo DeserializeUserAssignedIdentityAuth subscriptionId = property.Value.GetString(); continue; } + if (property.NameEquals("deleteOrUpdateBehavior")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + deleteOrUpdateBehavior = new DeleteOrUpdateBehavior(property.Value.GetString()); + continue; + } + if (property.NameEquals("roles")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + roles = array; + continue; + } + if (property.NameEquals("userName")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + userName = null; + continue; + } + userName = property.Value.GetString(); + continue; + } if (property.NameEquals("authType")) { authType = new LinkerAuthType(property.Value.GetString()); continue; } } - return new UserAssignedIdentityAuthInfo(authType, clientId.Value, subscriptionId.Value); + return new UserAssignedIdentityAuthInfo(authType, clientId.Value, subscriptionId.Value, Optional.ToNullable(deleteOrUpdateBehavior), Optional.ToList(roles), userName.Value); } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAssignedIdentityAuthInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAssignedIdentityAuthInfo.cs index c5cb3a6aef2c..e102f1d3882c 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAssignedIdentityAuthInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAssignedIdentityAuthInfo.cs @@ -5,6 +5,9 @@ #nullable disable +using System.Collections.Generic; +using Azure.Core; + namespace Azure.ResourceManager.ServiceLinker.Models { /// The authentication info when authType is userAssignedIdentity. @@ -13,6 +16,7 @@ public partial class UserAssignedIdentityAuthInfo : AuthBaseInfo /// Initializes a new instance of UserAssignedIdentityAuthInfo. public UserAssignedIdentityAuthInfo() { + Roles = new ChangeTrackingList(); AuthType = LinkerAuthType.UserAssignedIdentity; } @@ -20,10 +24,16 @@ public UserAssignedIdentityAuthInfo() /// The authentication type. /// Client Id for userAssignedIdentity. /// Subscription id for userAssignedIdentity. - internal UserAssignedIdentityAuthInfo(LinkerAuthType authType, string clientId, string subscriptionId) : base(authType) + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + /// Optional, this value specifies the Azure role to be assigned. + /// Username created in the database which is mapped to a user in AAD. + internal UserAssignedIdentityAuthInfo(LinkerAuthType authType, string clientId, string subscriptionId, DeleteOrUpdateBehavior? deleteOrUpdateBehavior, IList roles, string userName) : base(authType) { ClientId = clientId; SubscriptionId = subscriptionId; + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + Roles = roles; + UserName = userName; AuthType = authType; } @@ -31,5 +41,11 @@ internal UserAssignedIdentityAuthInfo(LinkerAuthType authType, string clientId, public string ClientId { get; set; } /// Subscription id for userAssignedIdentity. public string SubscriptionId { get; set; } + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + public DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get; set; } + /// Optional, this value specifies the Azure role to be assigned. + public IList Roles { get; } + /// Username created in the database which is mapped to a user in AAD. + public string UserName { get; set; } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/VnetSolution.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/VnetSolution.Serialization.cs index 704e7a3c0006..bfc57754d09f 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/VnetSolution.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/VnetSolution.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - internal partial class VnetSolution : IUtf8JsonSerializable + public partial class VnetSolution : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -27,12 +27,18 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("type"); } } + if (Optional.IsDefined(DeleteOrUpdateBehavior)) + { + writer.WritePropertyName("deleteOrUpdateBehavior"); + writer.WriteStringValue(DeleteOrUpdateBehavior.Value.ToString()); + } writer.WriteEndObject(); } internal static VnetSolution DeserializeVnetSolution(JsonElement element) { Optional type = default; + Optional deleteOrUpdateBehavior = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type")) @@ -45,8 +51,18 @@ internal static VnetSolution DeserializeVnetSolution(JsonElement element) type = new VnetSolutionType(property.Value.GetString()); continue; } + if (property.NameEquals("deleteOrUpdateBehavior")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + deleteOrUpdateBehavior = new DeleteOrUpdateBehavior(property.Value.GetString()); + continue; + } } - return new VnetSolution(Optional.ToNullable(type)); + return new VnetSolution(Optional.ToNullable(type), Optional.ToNullable(deleteOrUpdateBehavior)); } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/VnetSolution.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/VnetSolution.cs index 9dcab8722e0a..113e906933d0 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/VnetSolution.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/VnetSolution.cs @@ -8,7 +8,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { /// The VNet solution for linker. - internal partial class VnetSolution + public partial class VnetSolution { /// Initializes a new instance of VnetSolution. public VnetSolution() @@ -17,12 +17,16 @@ public VnetSolution() /// Initializes a new instance of VnetSolution. /// Type of VNet solution. - internal VnetSolution(VnetSolutionType? solutionType) + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + internal VnetSolution(VnetSolutionType? solutionType, DeleteOrUpdateBehavior? deleteOrUpdateBehavior) { SolutionType = solutionType; + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; } /// Type of VNet solution. public VnetSolutionType? SolutionType { get; set; } + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + public DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get; set; } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/ConfigurationNamesRestOperations.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/ConfigurationNamesRestOperations.cs new file mode 100644 index 000000000000..f46ba12445dc --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/ConfigurationNamesRestOperations.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker +{ + internal partial class ConfigurationNamesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ConfigurationNamesRestOperations. + /// 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 ConfigurationNamesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-11-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest(string filter, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.ServiceLinker/configurationNames", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the configuration names generated by Service Connector for all target, client types, auth types. + /// OData filter options. + /// OData skipToken option for pagination. + /// The cancellation token to use. + public async Task> ListAsync(string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(filter, skipToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationNameResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationNameResult.DeserializeConfigurationNameResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the configuration names generated by Service Connector for all target, client types, auth types. + /// OData filter options. + /// OData skipToken option for pagination. + /// The cancellation token to use. + public Response List(string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(filter, skipToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationNameResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationNameResult.DeserializeConfigurationNameResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string filter, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the configuration names generated by Service Connector for all target, client types, auth types. + /// The URL to the next page of results. + /// OData filter options. + /// OData skipToken option for pagination. + /// The cancellation token to use. + /// is null. + public async Task> ListNextPageAsync(string nextLink, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + + using var message = CreateListNextPageRequest(nextLink, filter, skipToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationNameResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationNameResult.DeserializeConfigurationNameResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the configuration names generated by Service Connector for all target, client types, auth types. + /// The URL to the next page of results. + /// OData filter options. + /// OData skipToken option for pagination. + /// The cancellation token to use. + /// is null. + public Response ListNextPage(string nextLink, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + + using var message = CreateListNextPageRequest(nextLink, filter, skipToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationNameResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationNameResult.DeserializeConfigurationNameResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/ConnectorRestOperations.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/ConnectorRestOperations.cs new file mode 100644 index 000000000000..ae2c51794367 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/ConnectorRestOperations.cs @@ -0,0 +1,1159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker +{ + internal partial class ConnectorRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ConnectorRestOperations. + /// 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 ConnectorRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-11-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListDryrunRequest(string subscriptionId, string resourceGroupName, AzureLocation location) + { + 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.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/dryruns", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// list dryrun jobs. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListDryrunAsync(string subscriptionId, string resourceGroupName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListDryrunRequest(subscriptionId, resourceGroupName, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DryrunList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DryrunList.DeserializeDryrunList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// list dryrun jobs. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListDryrun(string subscriptionId, string resourceGroupName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListDryrunRequest(subscriptionId, resourceGroupName, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DryrunList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DryrunList.DeserializeDryrunList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetDryrunRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName) + { + 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.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// get a dryrun job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of dryrun. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetDryrunAsync(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var message = CreateGetDryrunRequest(subscriptionId, resourceGroupName, location, dryrunName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DryrunResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DryrunResourceData.DeserializeDryrunResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DryrunResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// get a dryrun job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of dryrun. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response GetDryrun(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var message = CreateGetDryrunRequest(subscriptionId, resourceGroupName, location, dryrunName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DryrunResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DryrunResourceData.DeserializeDryrunResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DryrunResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateDryrunRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, DryrunResourceData 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.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// create a dryrun job to do necessary check before actual creation. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateDryrunAsync(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, DryrunResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateDryrunRequest(subscriptionId, resourceGroupName, location, dryrunName, 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 dryrun job to do necessary check before actual creation. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateDryrun(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, DryrunResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateDryrunRequest(subscriptionId, resourceGroupName, location, dryrunName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateDryrunRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, DryrunPatch 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.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/dryruns/", false); + uri.AppendPath(dryrunName, 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); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// update a dryrun job to do necessary check before actual creation. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateDryrunAsync(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, DryrunPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateDryrunRequest(subscriptionId, resourceGroupName, location, dryrunName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// update a dryrun job to do necessary check before actual creation. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response UpdateDryrun(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, DryrunPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateDryrunRequest(subscriptionId, resourceGroupName, location, dryrunName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteDryrunRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName) + { + 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.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// delete a dryrun job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of dryrun. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteDryrunAsync(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var message = CreateDeleteDryrunRequest(subscriptionId, resourceGroupName, location, dryrunName); + 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 dryrun job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of dryrun. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response DeleteDryrun(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var message = CreateDeleteDryrunRequest(subscriptionId, resourceGroupName, location, dryrunName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, AzureLocation location) + { + 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.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Returns list of connector which connects to the resource, which supports to config the target service during the resource provision. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResourceList.DeserializeResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns list of connector which connects to the resource, which supports to config the target service during the resource provision. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResourceList.DeserializeResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName) + { + 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.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Returns Connector resource for a given name. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of 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, AzureLocation location, string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, location, connectorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + LinkerResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LinkerResourceData.DeserializeLinkerResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((LinkerResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns Connector resource for a given name. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of 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, AzureLocation location, string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, location, connectorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + LinkerResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LinkerResourceData.DeserializeLinkerResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((LinkerResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, LinkerResourceData 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.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or update Connector resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// Connector details. + /// 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, AzureLocation location, string connectorName, LinkerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, location, connectorName, 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 or update Connector resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// Connector details. + /// 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, AzureLocation location, string connectorName, LinkerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, location, connectorName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName) + { + 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.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a Connector. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of 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, AzureLocation location, string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, location, connectorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a Connector. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of 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, AzureLocation location, string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, location, connectorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, LinkerPatch 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.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors/", false); + uri.AppendPath(connectorName, 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); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Operation to update an existing Connector. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// Connector details. + /// 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, AzureLocation location, string connectorName, LinkerPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, location, connectorName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Operation to update an existing Connector. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// Connector details. + /// 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, AzureLocation location, string connectorName, LinkerPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, location, connectorName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateValidateRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName) + { + 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.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendPath("/validate", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Validate a Connector. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task ValidateAsync(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateValidateRequest(subscriptionId, resourceGroupName, location, connectorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Validate a Connector. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Validate(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateValidateRequest(subscriptionId, resourceGroupName, location, connectorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGenerateConfigurationsRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, ConfigurationInfo info) + { + 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.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendPath("/generateConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (info != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(info); + request.Content = content; + } + _userAgent.Apply(message); + return message; + } + + /// Generate configurations for a Connector. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// Connection Info, including format, secret store, etc. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GenerateConfigurationsAsync(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, ConfigurationInfo info = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateGenerateConfigurationsRequest(subscriptionId, resourceGroupName, location, connectorName, info); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationResult.DeserializeConfigurationResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Generate configurations for a Connector. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// Connection Info, including format, secret store, etc. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response GenerateConfigurations(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, ConfigurationInfo info = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateGenerateConfigurationsRequest(subscriptionId, resourceGroupName, location, connectorName, info); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationResult.DeserializeConfigurationResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListDryrunNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation location) + { + 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 dryrun jobs. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListDryrunNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListDryrunNextPageRequest(nextLink, subscriptionId, resourceGroupName, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DryrunList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DryrunList.DeserializeDryrunList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// list dryrun jobs. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListDryrunNextPage(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListDryrunNextPageRequest(nextLink, subscriptionId, resourceGroupName, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DryrunList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DryrunList.DeserializeDryrunList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation location) + { + 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; + } + + /// Returns list of connector which connects to the resource, which supports to config the target service during the resource provision. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResourceList.DeserializeResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns list of connector which connects to the resource, which supports to config the target service during the resource provision. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResourceList.DeserializeResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/LinkerRestOperations.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/LinkerRestOperations.cs index 7c449a18fdf9..0e78c5f1a804 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/LinkerRestOperations.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/LinkerRestOperations.cs @@ -33,7 +33,7 @@ public LinkerRestOperations(HttpPipeline pipeline, string applicationId, Uri end { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-05-01"; + _apiVersion = apiVersion ?? "2022-11-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -54,11 +54,11 @@ internal HttpMessage CreateListRequest(string resourceUri) return message; } - /// Returns list of Linkers which connects to the resource. + /// Returns list of Linkers which connects to the resource. which supports to config both application and target service during the resource provision. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The cancellation token to use. /// is null. - public async Task> ListAsync(string resourceUri, CancellationToken cancellationToken = default) + public async Task> ListAsync(string resourceUri, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceUri, nameof(resourceUri)); @@ -68,9 +68,9 @@ public async Task> ListAsync(string resourceUri, Cancellati { case 200: { - LinkerList value = default; + ResourceList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = LinkerList.DeserializeLinkerList(document.RootElement); + value = ResourceList.DeserializeResourceList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -78,11 +78,11 @@ public async Task> ListAsync(string resourceUri, Cancellati } } - /// Returns list of Linkers which connects to the resource. + /// Returns list of Linkers which connects to the resource. which supports to config both application and target service during the resource provision. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The cancellation token to use. /// is null. - public Response List(string resourceUri, CancellationToken cancellationToken = default) + public Response List(string resourceUri, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceUri, nameof(resourceUri)); @@ -92,9 +92,9 @@ public Response List(string resourceUri, CancellationToken cancellat { case 200: { - LinkerList value = default; + ResourceList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = LinkerList.DeserializeLinkerList(document.RootElement); + value = ResourceList.DeserializeResourceList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -200,7 +200,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceUri, string link return message; } - /// Create or update linker resource. + /// Create or update Linker resource. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// Linker details. @@ -225,7 +225,7 @@ public async Task CreateOrUpdateAsync(string resourceUri, string linke } } - /// Create or update linker resource. + /// Create or update Linker resource. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// Linker details. @@ -268,7 +268,7 @@ internal HttpMessage CreateDeleteRequest(string resourceUri, string linkerName) return message; } - /// Delete a link. + /// Delete a Linker. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// The cancellation token to use. @@ -292,7 +292,7 @@ public async Task DeleteAsync(string resourceUri, string linkerName, C } } - /// Delete a link. + /// Delete a Linker. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// The cancellation token to use. @@ -316,7 +316,7 @@ public Response Delete(string resourceUri, string linkerName, CancellationToken } } - internal HttpMessage CreateUpdateRequest(string resourceUri, string linkerName, LinkerResourcePatch patch) + internal HttpMessage CreateUpdateRequest(string resourceUri, string linkerName, LinkerPatch patch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -338,14 +338,14 @@ internal HttpMessage CreateUpdateRequest(string resourceUri, string linkerName, return message; } - /// Operation to update an existing link. + /// Operation to update an existing Linker. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// Linker details. /// 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 linkerName, LinkerResourcePatch patch, CancellationToken cancellationToken = default) + public async Task UpdateAsync(string resourceUri, string linkerName, LinkerPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceUri, nameof(resourceUri)); Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); @@ -363,14 +363,14 @@ public async Task UpdateAsync(string resourceUri, string linkerName, L } } - /// Operation to update an existing link. + /// Operation to update an existing Linker. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// Linker details. /// 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 linkerName, LinkerResourcePatch patch, CancellationToken cancellationToken = default) + public Response Update(string resourceUri, string linkerName, LinkerPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceUri, nameof(resourceUri)); Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); @@ -407,7 +407,7 @@ internal HttpMessage CreateValidateRequest(string resourceUri, string linkerName return message; } - /// Validate a link. + /// Validate a Linker. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// The cancellation token to use. @@ -430,7 +430,7 @@ public async Task ValidateAsync(string resourceUri, string linkerName, } } - /// Validate a link. + /// Validate a Linker. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// The cancellation token to use. @@ -472,13 +472,13 @@ internal HttpMessage CreateListConfigurationsRequest(string resourceUri, string return message; } - /// list source configurations for a linker. + /// list source configurations for a Linker. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. - public async Task> ListConfigurationsAsync(string resourceUri, string linkerName, CancellationToken cancellationToken = default) + public async Task> ListConfigurationsAsync(string resourceUri, string linkerName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceUri, nameof(resourceUri)); Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); @@ -489,9 +489,9 @@ public async Task> ListConfigurationsAsync(s { case 200: { - SourceConfigurationResult value = default; + ConfigurationResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = SourceConfigurationResult.DeserializeSourceConfigurationResult(document.RootElement); + value = ConfigurationResult.DeserializeConfigurationResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -499,13 +499,13 @@ public async Task> ListConfigurationsAsync(s } } - /// list source configurations for a linker. + /// list source configurations for a Linker. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. - public Response ListConfigurations(string resourceUri, string linkerName, CancellationToken cancellationToken = default) + public Response ListConfigurations(string resourceUri, string linkerName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceUri, nameof(resourceUri)); Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); @@ -516,9 +516,9 @@ public Response ListConfigurations(string resourceUri { case 200: { - SourceConfigurationResult value = default; + ConfigurationResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = SourceConfigurationResult.DeserializeSourceConfigurationResult(document.RootElement); + value = ConfigurationResult.DeserializeConfigurationResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -540,12 +540,12 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceU return message; } - /// Returns list of Linkers which connects to the resource. + /// Returns list of Linkers which connects to the resource. which supports to config both application and target service during the resource provision. /// The URL to the next page of results. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The cancellation token to use. /// or is null. - public async Task> ListNextPageAsync(string nextLink, string resourceUri, CancellationToken cancellationToken = default) + public async Task> ListNextPageAsync(string nextLink, string resourceUri, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNull(resourceUri, nameof(resourceUri)); @@ -556,9 +556,9 @@ public async Task> ListNextPageAsync(string nextLink, strin { case 200: { - LinkerList value = default; + ResourceList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = LinkerList.DeserializeLinkerList(document.RootElement); + value = ResourceList.DeserializeResourceList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -566,12 +566,12 @@ public async Task> ListNextPageAsync(string nextLink, strin } } - /// Returns list of Linkers which connects to the resource. + /// Returns list of Linkers which connects to the resource. which supports to config both application and target service during the resource provision. /// The URL to the next page of results. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The cancellation token to use. /// or is null. - public Response ListNextPage(string nextLink, string resourceUri, CancellationToken cancellationToken = default) + public Response ListNextPage(string nextLink, string resourceUri, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNull(resourceUri, nameof(resourceUri)); @@ -582,9 +582,9 @@ public Response ListNextPage(string nextLink, string resourceUri, Ca { case 200: { - LinkerList value = default; + ResourceList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = LinkerList.DeserializeLinkerList(document.RootElement); + value = ResourceList.DeserializeResourceList(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/LinkersRestOperations.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/LinkersRestOperations.cs new file mode 100644 index 000000000000..db971a323e68 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/LinkersRestOperations.cs @@ -0,0 +1,537 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker +{ + internal partial class LinkersRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of LinkersRestOperations. + /// 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 LinkersRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2022-11-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListDryrunRequest(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.ServiceLinker/dryruns", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// list dryrun jobs. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The cancellation token to use. + /// is null. + public async Task> ListDryrunAsync(string resourceUri, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListDryrunRequest(resourceUri); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DryrunList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DryrunList.DeserializeDryrunList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// list dryrun jobs. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The cancellation token to use. + /// is null. + public Response ListDryrun(string resourceUri, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListDryrunRequest(resourceUri); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DryrunList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DryrunList.DeserializeDryrunList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetDryrunRequest(string resourceUri, string dryrunName) + { + 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.ServiceLinker/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// get a dryrun job. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name of dryrun. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> GetDryrunAsync(string resourceUri, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var message = CreateGetDryrunRequest(resourceUri, dryrunName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DryrunResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DryrunResourceData.DeserializeDryrunResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DryrunResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// get a dryrun job. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name of dryrun. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response GetDryrun(string resourceUri, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var message = CreateGetDryrunRequest(resourceUri, dryrunName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DryrunResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DryrunResourceData.DeserializeDryrunResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DryrunResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateDryrunRequest(string resourceUri, string dryrunName, DryrunResourceData 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.ServiceLinker/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// create a dryrun job to do necessary check before actual creation. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task CreateDryrunAsync(string resourceUri, string dryrunName, DryrunResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateDryrunRequest(resourceUri, dryrunName, 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 dryrun job to do necessary check before actual creation. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public Response CreateDryrun(string resourceUri, string dryrunName, DryrunResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateDryrunRequest(resourceUri, dryrunName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateDryrunRequest(string resourceUri, string dryrunName, DryrunPatch 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.ServiceLinker/dryruns/", false); + uri.AppendPath(dryrunName, 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); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// add a dryrun job to do necessary check before actual creation. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task UpdateDryrunAsync(string resourceUri, string dryrunName, DryrunPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateDryrunRequest(resourceUri, dryrunName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// add a dryrun job to do necessary check before actual creation. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public Response UpdateDryrun(string resourceUri, string dryrunName, DryrunPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateDryrunRequest(resourceUri, dryrunName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteDryrunRequest(string resourceUri, string dryrunName) + { + 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.ServiceLinker/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// delete a dryrun job. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name of dryrun. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task DeleteDryrunAsync(string resourceUri, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var message = CreateDeleteDryrunRequest(resourceUri, dryrunName); + 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 dryrun job. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name of dryrun. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response DeleteDryrun(string resourceUri, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var message = CreateDeleteDryrunRequest(resourceUri, dryrunName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGenerateConfigurationsRequest(string resourceUri, string linkerName, ConfigurationInfo info) + { + 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.ServiceLinker/linkers/", false); + uri.AppendPath(linkerName, true); + uri.AppendPath("/generateConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (info != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(info); + request.Content = content; + } + _userAgent.Apply(message); + return message; + } + + /// Generate configurations for a Linker. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name Linker resource. + /// Connection Info, including format, secret store, etc. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> GenerateConfigurationsAsync(string resourceUri, string linkerName, ConfigurationInfo info = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); + + using var message = CreateGenerateConfigurationsRequest(resourceUri, linkerName, info); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationResult.DeserializeConfigurationResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Generate configurations for a Linker. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name Linker resource. + /// Connection Info, including format, secret store, etc. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response GenerateConfigurations(string resourceUri, string linkerName, ConfigurationInfo info = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); + + using var message = CreateGenerateConfigurationsRequest(resourceUri, linkerName, info); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationResult.DeserializeConfigurationResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListDryrunNextPageRequest(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 dryrun jobs. + /// The URL to the next page of results. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The cancellation token to use. + /// or is null. + public async Task> ListDryrunNextPageAsync(string nextLink, string resourceUri, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListDryrunNextPageRequest(nextLink, resourceUri); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DryrunList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DryrunList.DeserializeDryrunList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// list dryrun jobs. + /// The URL to the next page of results. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The cancellation token to use. + /// or is null. + public Response ListDryrunNextPage(string nextLink, string resourceUri, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListDryrunNextPageRequest(nextLink, resourceUri); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DryrunList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DryrunList.DeserializeDryrunList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/autorest.md b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/autorest.md index d0897d96d1cb..c218a41fb77d 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/autorest.md +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/autorest.md @@ -8,7 +8,7 @@ azure-arm: true csharp: true library-name: ServiceLinker namespace: Azure.ResourceManager.ServiceLinker -require: https://github.com/Azure/azure-rest-api-specs/blob/42ca0236ef14093f5aff0694efa34d5594e814a0/specification/servicelinker/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/servicelinker/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true skip-csproj: true