diff --git a/sdk/core/Azure.Core/src/Pipeline/HttpPipeline.cs b/sdk/core/Azure.Core/src/Pipeline/HttpPipeline.cs index c283475c0d86..b28244d63f78 100644 --- a/sdk/core/Azure.Core/src/Pipeline/HttpPipeline.cs +++ b/sdk/core/Azure.Core/src/Pipeline/HttpPipeline.cs @@ -70,7 +70,9 @@ public ValueTask SendAsync(HttpMessage message, CancellationToken cancellationTo { message.CancellationToken = cancellationToken; AddHttpMessageProperties(message); - return _pipeline.Span[0].ProcessAsync(message, _pipeline.Slice(1)); + var value = _pipeline.Span[0].ProcessAsync(message, _pipeline.Slice(1)); + message.Response.Message = message; + return value; } /// @@ -83,6 +85,7 @@ public void Send(HttpMessage message, CancellationToken cancellationToken) message.CancellationToken = cancellationToken; AddHttpMessageProperties(message); _pipeline.Span[0].Process(message, _pipeline.Slice(1)); + message.Response.Message = message; } /// /// Invokes the pipeline asynchronously with the provided request. diff --git a/sdk/core/Azure.Core/src/Response.cs b/sdk/core/Azure.Core/src/Response.cs index e31a6ec4752a..4f64ecb830b5 100644 --- a/sdk/core/Azure.Core/src/Response.cs +++ b/sdk/core/Azure.Core/src/Response.cs @@ -5,7 +5,9 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.IO; +using System.Threading.Tasks; using Azure.Core; +using Azure.Core.Pipeline; namespace Azure { @@ -111,6 +113,34 @@ public virtual BinaryData Content /// The enumerating in the response. protected internal abstract IEnumerable EnumerateHeaders(); + internal HttpMessage? Message { get; set; } + + /// + /// + /// + public bool IsError() + { + return this.Message!.ResponseClassifier.IsErrorResponse(this.Message); + } + + /// + /// Throw a RequestFailedException appropriate to the Response. + /// + public void Throw() + { + throw this.Message!.ResponseClassifier.CreateRequestFailedException(this); + //throw new RequestFailedException(""); + } + + /// + /// Throw a RequestFailedException appropriate to the Response. + /// + public async Task ThrowAsync() + { + throw await this.Message!.ResponseClassifier.CreateRequestFailedExceptionAsync(this).ConfigureAwait(false); + //throw new RequestFailedException(""); + } + /// /// Creates a new instance of with the provided value and HTTP response. /// diff --git a/sdk/core/Azure.Core/src/ResponseClassifier.cs b/sdk/core/Azure.Core/src/ResponseClassifier.cs index e770e6e43271..1b778479247e 100644 --- a/sdk/core/Azure.Core/src/ResponseClassifier.cs +++ b/sdk/core/Azure.Core/src/ResponseClassifier.cs @@ -2,7 +2,14 @@ // Licensed under the MIT License. using System; +using System.Collections.Generic; +using System.Globalization; using System.IO; +using System.Linq; +using System.Text; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core.Pipeline; namespace Azure.Core { @@ -11,6 +18,30 @@ namespace Azure.Core /// public class ResponseClassifier { + private const string DefaultFailureMessage = "Service request failed."; + + private readonly HttpMessageSanitizer _sanitizer; + + /// + /// Initializes a new instance of . + /// + public ResponseClassifier() : this(new DefaultClientOptions()) + { + } + + /// + /// + + /// + /// Initializes a new instance of . + /// + public ResponseClassifier(ClientOptions options) + { + _sanitizer = new HttpMessageSanitizer( + options?.Diagnostics.LoggedQueryParameters.ToArray() ?? Array.Empty(), + options?.Diagnostics.LoggedHeaderNames.ToArray() ?? Array.Empty()); + } + /// /// Specifies if the request contained in the should be retried. /// @@ -57,5 +88,165 @@ public virtual bool IsErrorResponse(HttpMessage message) var statusKind = message.Response.Status / 100; return statusKind == 4 || statusKind == 5; } + + /// + /// + public async ValueTask CreateRequestFailedExceptionAsync(Response response, string? message = null, string? errorCode = null, IDictionary? additionalInfo = null, Exception? innerException = null) + { + var content = await ReadContentAsync(response, true).ConfigureAwait(false); + ExtractFailureContent(content, ref message, ref errorCode); + return CreateRequestFailedExceptionWithContent(response, message, content, errorCode, additionalInfo, innerException); + } + + /// + /// + public RequestFailedException CreateRequestFailedException(Response response, string? message = null, string? errorCode = null, IDictionary? additionalInfo = null, Exception? innerException = null) + { + string? content = ReadContentAsync(response, false).EnsureCompleted(); + ExtractFailureContent(content, ref message, ref errorCode); + return CreateRequestFailedExceptionWithContent(response, message, content, errorCode, additionalInfo, innerException); + } + + private static async ValueTask ReadContentAsync(Response response, bool async) + { + string? content = null; + + if (response.ContentStream != null && + ContentTypeUtilities.TryGetTextEncoding(response.Headers.ContentType, out var encoding)) + { + using (var streamReader = new StreamReader(response.ContentStream, encoding)) + { + content = async ? await streamReader.ReadToEndAsync().ConfigureAwait(false) : streamReader.ReadToEnd(); + } + } + + return content; + } + + private static void ExtractFailureContent( + string? content, + ref string? message, + ref string? errorCode) + { + try + { + // Optimistic check for JSON object we expect + if (content == null || + !content.StartsWith("{", StringComparison.OrdinalIgnoreCase)) + return; + + string? parsedMessage = null; + using JsonDocument document = JsonDocument.Parse(content); + if (document.RootElement.TryGetProperty("error", out var errorProperty)) + { + if (errorProperty.TryGetProperty("code", out var codeProperty)) + { + errorCode = codeProperty.GetString(); + } + if (errorProperty.TryGetProperty("message", out var messageProperty)) + { + parsedMessage = messageProperty.GetString(); + } + } + + // Make sure we parsed a message so we don't overwrite the value with null + if (parsedMessage != null) + { + message = parsedMessage; + } + } + catch (Exception) + { + // Ignore any failures - unexpected content will be + // included verbatim in the detailed error message + } + } + + private RequestFailedException CreateRequestFailedExceptionWithContent( + Response response, + string? message = null, + string? content = null, + string? errorCode = null, + IDictionary? additionalInfo = null, + Exception? innerException = null) + { + var formatMessage = CreateRequestFailedMessageWithContent(response, message, content, errorCode, additionalInfo); + var exception = new RequestFailedException(response.Status, formatMessage, errorCode, innerException); + + if (additionalInfo != null) + { + foreach (KeyValuePair keyValuePair in additionalInfo) + { + exception.Data.Add(keyValuePair.Key, keyValuePair.Value); + } + } + + return exception; + } + + private string CreateRequestFailedMessageWithContent( + Response response, + string? message, + string? content, + string? errorCode, + IDictionary? additionalInfo) + { + StringBuilder messageBuilder = new StringBuilder() + .AppendLine(message ?? DefaultFailureMessage) + .Append("Status: ") + .Append(response.Status.ToString(CultureInfo.InvariantCulture)); + + if (!string.IsNullOrEmpty(response.ReasonPhrase)) + { + messageBuilder.Append(" (") + .Append(response.ReasonPhrase) + .AppendLine(")"); + } + else + { + messageBuilder.AppendLine(); + } + + if (!string.IsNullOrWhiteSpace(errorCode)) + { + messageBuilder.Append("ErrorCode: ") + .Append(errorCode) + .AppendLine(); + } + + if (additionalInfo != null && additionalInfo.Count > 0) + { + messageBuilder + .AppendLine() + .AppendLine("Additional Information:"); + foreach (KeyValuePair info in additionalInfo) + { + messageBuilder + .Append(info.Key) + .Append(": ") + .AppendLine(info.Value); + } + } + + if (content != null) + { + messageBuilder + .AppendLine() + .AppendLine("Content:") + .AppendLine(content); + } + + messageBuilder + .AppendLine() + .AppendLine("Headers:"); + + foreach (HttpHeader responseHeader in response.Headers) + { + string headerValue = _sanitizer.SanitizeHeader(responseHeader.Name, responseHeader.Value); + messageBuilder.AppendLine($"{responseHeader.Name}: {headerValue}"); + } + + return messageBuilder.ToString(); + } } } diff --git a/sdk/core/Azure.Core/src/Shared/ClientDiagnostics.cs b/sdk/core/Azure.Core/src/Shared/ClientDiagnostics.cs index a7dac8c8e88f..440270a002c6 100644 --- a/sdk/core/Azure.Core/src/Shared/ClientDiagnostics.cs +++ b/sdk/core/Azure.Core/src/Shared/ClientDiagnostics.cs @@ -3,16 +3,13 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; -using System.Net.Http.Headers; using System.Reflection; using System.Text; using System.Text.Json; using System.Threading.Tasks; -using Azure.Core.Pipeline; #nullable enable @@ -20,184 +17,11 @@ namespace Azure.Core.Pipeline { internal class ClientDiagnostics : DiagnosticScopeFactory { - private const string DefaultMessage = "Service request failed."; - - private readonly HttpMessageSanitizer _sanitizer; public ClientDiagnostics(ClientOptions options) : base( options.GetType().Namespace!, GetResourceProviderNamespace(options.GetType().Assembly), options.Diagnostics.IsDistributedTracingEnabled) { - _sanitizer = new HttpMessageSanitizer( - options.Diagnostics.LoggedQueryParameters.ToArray(), - options.Diagnostics.LoggedHeaderNames.ToArray()); - } - - /// - /// Partial method that can optionally be defined to extract the error - /// message, code, and details in a service specific manner. - /// - /// The error content. - /// The response headers. - /// The error message. - /// The error code. - /// Additional error details. - protected virtual void ExtractFailureContent( - string? content, - ResponseHeaders responseHeaders, - ref string? message, - ref string? errorCode, - ref IDictionary? additionalInfo) - { - try - { - // Optimistic check for JSON object we expect - if (content == null || - !content.StartsWith("{", StringComparison.OrdinalIgnoreCase)) return; - - string? parsedMessage = null; - using JsonDocument document = JsonDocument.Parse(content); - if (document.RootElement.TryGetProperty("error", out var errorProperty)) - { - if (errorProperty.TryGetProperty("code", out var codeProperty)) - { - errorCode = codeProperty.GetString(); - } - if (errorProperty.TryGetProperty("message", out var messageProperty)) - { - parsedMessage = messageProperty.GetString(); - } - } - - // Make sure we parsed a message so we don't overwrite the value with null - if (parsedMessage != null) - { - message = parsedMessage; - } - } - catch (Exception) - { - // Ignore any failures - unexpected content will be - // included verbatim in the detailed error message - } - } - - public async ValueTask CreateRequestFailedExceptionAsync(Response response, string? message = null, string? errorCode = null, IDictionary? additionalInfo = null, Exception? innerException = null) - { - var content = await ReadContentAsync(response, true).ConfigureAwait(false); - ExtractFailureContent(content, response.Headers, ref message, ref errorCode, ref additionalInfo); - return CreateRequestFailedExceptionWithContent(response, message, content, errorCode, additionalInfo, innerException); - } - - public RequestFailedException CreateRequestFailedException(Response response, string? message = null, string? errorCode = null, IDictionary? additionalInfo = null, Exception? innerException = null) - { - string? content = ReadContentAsync(response, false).EnsureCompleted(); - ExtractFailureContent(content, response.Headers, ref message, ref errorCode, ref additionalInfo); - return CreateRequestFailedExceptionWithContent(response, message, content, errorCode, additionalInfo, innerException); - } - - public RequestFailedException CreateRequestFailedExceptionWithContent( - Response response, - string? message = null, - string? content = null, - string? errorCode = null, - IDictionary? additionalInfo = null, - Exception? innerException = null) - { - var formatMessage = CreateRequestFailedMessageWithContent(response, message, content, errorCode, additionalInfo); - var exception = new RequestFailedException(response.Status, formatMessage, errorCode, innerException); - - if (additionalInfo != null) - { - foreach (KeyValuePair keyValuePair in additionalInfo) - { - exception.Data.Add(keyValuePair.Key, keyValuePair.Value); - } - } - - return exception; - } - - public async ValueTask CreateRequestFailedMessageAsync(Response response, string? message, string? errorCode, IDictionary? additionalInfo, bool async) - { - var content = await ReadContentAsync(response, async).ConfigureAwait(false); - return CreateRequestFailedMessageWithContent(response, message, content, errorCode, additionalInfo); - } - - public string CreateRequestFailedMessageWithContent(Response response, string? message, string? content, string? errorCode, IDictionary? additionalInfo) - { - StringBuilder messageBuilder = new StringBuilder() - .AppendLine(message ?? DefaultMessage) - .Append("Status: ") - .Append(response.Status.ToString(CultureInfo.InvariantCulture)); - - if (!string.IsNullOrEmpty(response.ReasonPhrase)) - { - messageBuilder.Append(" (") - .Append(response.ReasonPhrase) - .AppendLine(")"); - } - else - { - messageBuilder.AppendLine(); - } - - if (!string.IsNullOrWhiteSpace(errorCode)) - { - messageBuilder.Append("ErrorCode: ") - .Append(errorCode) - .AppendLine(); - } - - if (additionalInfo != null && additionalInfo.Count > 0) - { - messageBuilder - .AppendLine() - .AppendLine("Additional Information:"); - foreach (KeyValuePair info in additionalInfo) - { - messageBuilder - .Append(info.Key) - .Append(": ") - .AppendLine(info.Value); - } - } - - if (content != null) - { - messageBuilder - .AppendLine() - .AppendLine("Content:") - .AppendLine(content); - } - - messageBuilder - .AppendLine() - .AppendLine("Headers:"); - - foreach (HttpHeader responseHeader in response.Headers) - { - string headerValue = _sanitizer.SanitizeHeader(responseHeader.Name, responseHeader.Value); - messageBuilder.AppendLine($"{responseHeader.Name}: {headerValue}"); - } - - return messageBuilder.ToString(); - } - - private static async ValueTask ReadContentAsync(Response response, bool async) - { - string? content = null; - - if (response.ContentStream != null && - ContentTypeUtilities.TryGetTextEncoding(response.Headers.ContentType, out var encoding)) - { - using (var streamReader = new StreamReader(response.ContentStream, encoding)) - { - content = async ? await streamReader.ReadToEndAsync().ConfigureAwait(false) : streamReader.ReadToEnd(); - } - } - - return content; } internal static string? GetResourceProviderNamespace(Assembly assembly) diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/api/Azure.Analytics.Synapse.AccessControl.netstandard2.0.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/api/Azure.Analytics.Synapse.AccessControl.netstandard2.0.cs index 824e8a0674b6..f54129f1714d 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/api/Azure.Analytics.Synapse.AccessControl.netstandard2.0.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/api/Azure.Analytics.Synapse.AccessControl.netstandard2.0.cs @@ -1,107 +1,97 @@ namespace Azure.Analytics.Synapse.AccessControl { - public partial class AccessControlClientOptions : Azure.Core.ClientOptions + public partial class SynapseAccessControlClient { - public AccessControlClientOptions(Azure.Analytics.Synapse.AccessControl.AccessControlClientOptions.ServiceVersion version = Azure.Analytics.Synapse.AccessControl.AccessControlClientOptions.ServiceVersion.V2020_12_01) { } + protected SynapseAccessControlClient() { } + public SynapseAccessControlClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Synapse.AccessControl.SynapseAdministrationClientOptions options = null) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CheckPrincipalAccess(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } + public virtual System.Threading.Tasks.Task CheckPrincipalAccessAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response CreateRoleAssignment(Azure.Analytics.Synapse.AccessControl.SynapseRoleScope roleScope, string roleDefinitionId, string principalId, System.Guid? roleAssignmentName = default(System.Guid?)) { throw null; } + public virtual Azure.Response CreateRoleAssignment(string roleAssignmentId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } + public virtual System.Threading.Tasks.Task> CreateRoleAssignmentAsync(Azure.Analytics.Synapse.AccessControl.SynapseRoleScope roleScope, string roleDefinitionId, string principalId, System.Guid? roleAssignmentName = default(System.Guid?)) { throw null; } + public virtual System.Threading.Tasks.Task CreateRoleAssignmentAsync(string roleAssignmentId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response DeleteRoleAssignment(Azure.Analytics.Synapse.AccessControl.SynapseRoleScope roleScope, string roleAssignmentName) { throw null; } + public virtual System.Threading.Tasks.Task DeleteRoleAssignmentAsync(Azure.Analytics.Synapse.AccessControl.SynapseRoleScope roleScope, string roleAssignmentName) { throw null; } + public virtual Azure.Response DeleteRoleAssignmentById(string roleAssignmentId, string scope = null, Azure.RequestOptions options = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteRoleAssignmentByIdAsync(string roleAssignmentId, string scope = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetRoleAssignment(Azure.Analytics.Synapse.AccessControl.SynapseRoleScope roleScope, string roleAssignmentName) { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleAssignmentAsync(Azure.Analytics.Synapse.AccessControl.SynapseRoleScope roleScope, string roleAssignmentName) { throw null; } + public virtual Azure.Response GetRoleAssignmentById(string roleAssignmentId, Azure.RequestOptions options = null) { throw null; } + public virtual System.Threading.Tasks.Task GetRoleAssignmentByIdAsync(string roleAssignmentId, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Pageable GetRoleAssignments(Azure.Analytics.Synapse.AccessControl.SynapseRoleScope? roleScope = default(Azure.Analytics.Synapse.AccessControl.SynapseRoleScope?)) { throw null; } + public virtual Azure.AsyncPageable GetRoleAssignmentsAsync(Azure.Analytics.Synapse.AccessControl.SynapseRoleScope? roleScope = default(Azure.Analytics.Synapse.AccessControl.SynapseRoleScope?)) { throw null; } + public virtual Azure.Response GetRoleDefinition(Azure.Analytics.Synapse.AccessControl.SynapseRoleScope roleScope, System.Guid roleDefinitionName) { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleDefinitionAsync(Azure.Analytics.Synapse.AccessControl.SynapseRoleScope roleScope, System.Guid roleDefinitionName) { throw null; } + public virtual Azure.Response GetRoleDefinitionById(string roleDefinitionId, Azure.RequestOptions options = null) { throw null; } + public virtual System.Threading.Tasks.Task GetRoleDefinitionByIdAsync(string roleDefinitionId, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Pageable GetRoleDefinitions(Azure.Analytics.Synapse.AccessControl.SynapseRoleScope roleScope) { throw null; } + public virtual Azure.AsyncPageable GetRoleDefinitionsAsync(Azure.Analytics.Synapse.AccessControl.SynapseRoleScope roleScope) { throw null; } + public virtual Azure.Response ListRoleAssignments(string roleId = null, string principalId = null, string scope = null, string continuationToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual System.Threading.Tasks.Task ListRoleAssignmentsAsync(string roleId = null, string principalId = null, string scope = null, string continuationToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response ListRoleDefinitions(bool? isBuiltIn = default(bool?), string scope = null, Azure.RequestOptions options = null) { throw null; } + public virtual System.Threading.Tasks.Task ListRoleDefinitionsAsync(bool? isBuiltIn = default(bool?), string scope = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response ListScopes(Azure.RequestOptions options = null) { throw null; } + public virtual System.Threading.Tasks.Task ListScopesAsync(Azure.RequestOptions options = null) { throw null; } + } + public partial class SynapseAdministrationClientOptions : Azure.Core.ClientOptions + { + public SynapseAdministrationClientOptions(Azure.Analytics.Synapse.AccessControl.SynapseAdministrationClientOptions.ServiceVersion version = Azure.Analytics.Synapse.AccessControl.SynapseAdministrationClientOptions.ServiceVersion.V2020_12_01) { } public enum ServiceVersion { V2020_12_01 = 1, } } - public partial class RoleAssignmentsClient - { - protected RoleAssignmentsClient() { } - public RoleAssignmentsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Synapse.AccessControl.AccessControlClientOptions options = null) { } - public virtual Azure.Response CheckPrincipalAccess(Azure.Analytics.Synapse.AccessControl.Models.SubjectInfo subject, System.Collections.Generic.IEnumerable actions, string scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CheckPrincipalAccessAsync(Azure.Analytics.Synapse.AccessControl.Models.SubjectInfo subject, System.Collections.Generic.IEnumerable actions, string scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response CreateRoleAssignment(string roleAssignmentId, System.Guid roleId, System.Guid principalId, string scope, string principalType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CreateRoleAssignmentAsync(string roleAssignmentId, System.Guid roleId, System.Guid principalId, string scope, string principalType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response DeleteRoleAssignmentById(string roleAssignmentId, string scope = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteRoleAssignmentByIdAsync(string roleAssignmentId, string scope = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetRoleAssignmentById(string roleAssignmentId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetRoleAssignmentByIdAsync(string roleAssignmentId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response ListRoleAssignments(string roleId = null, string principalId = null, string scope = null, string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ListRoleAssignmentsAsync(string roleId = null, string principalId = null, string scope = null, string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } - public partial class RoleDefinitionsClient - { - protected RoleDefinitionsClient() { } - public RoleDefinitionsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Synapse.AccessControl.AccessControlClientOptions options = null) { } - public virtual Azure.Response GetRoleDefinitionById(string roleDefinitionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetRoleDefinitionByIdAsync(string roleDefinitionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response> ListRoleDefinitions(bool? isBuiltIn = default(bool?), string scope = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task>> ListRoleDefinitionsAsync(bool? isBuiltIn = default(bool?), string scope = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response> ListScopes(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task>> ListScopesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } -} -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - public static partial class AccessControlModelFactory - { - public static Azure.Analytics.Synapse.AccessControl.Models.CheckAccessDecision CheckAccessDecision(string accessDecision = null, string actionId = null, Azure.Analytics.Synapse.AccessControl.Models.RoleAssignmentDetails roleAssignment = null) { throw null; } - public static Azure.Analytics.Synapse.AccessControl.Models.CheckPrincipalAccessResponse CheckPrincipalAccessResponse(System.Collections.Generic.IEnumerable accessDecisions = null) { throw null; } - public static Azure.Analytics.Synapse.AccessControl.Models.RoleAssignmentDetails RoleAssignmentDetails(string id = null, System.Guid? roleDefinitionId = default(System.Guid?), System.Guid? principalId = default(System.Guid?), string scope = null, string principalType = null) { throw null; } - public static Azure.Analytics.Synapse.AccessControl.Models.RoleAssignmentDetailsList RoleAssignmentDetailsList(int? count = default(int?), System.Collections.Generic.IEnumerable value = null) { throw null; } - public static Azure.Analytics.Synapse.AccessControl.Models.SynapseRbacPermission SynapseRbacPermission(System.Collections.Generic.IEnumerable actions = null, System.Collections.Generic.IEnumerable notActions = null, System.Collections.Generic.IEnumerable dataActions = null, System.Collections.Generic.IEnumerable notDataActions = null) { throw null; } - public static Azure.Analytics.Synapse.AccessControl.Models.SynapseRoleDefinition SynapseRoleDefinition(System.Guid? id = default(System.Guid?), string name = null, bool? isBuiltIn = default(bool?), string description = null, System.Collections.Generic.IEnumerable permissions = null, System.Collections.Generic.IEnumerable scopes = null, string availabilityStatus = null) { throw null; } - } - public partial class CheckAccessDecision - { - internal CheckAccessDecision() { } - public string AccessDecision { get { throw null; } } - public string ActionId { get { throw null; } } - public Azure.Analytics.Synapse.AccessControl.Models.RoleAssignmentDetails RoleAssignment { get { throw null; } } - } - public partial class CheckPrincipalAccessResponse - { - internal CheckPrincipalAccessResponse() { } - public System.Collections.Generic.IReadOnlyList AccessDecisions { get { throw null; } } - } - public partial class RequiredAction + public partial class SynapsePermission { - public RequiredAction(string id, bool isDataAction) { } - public string Id { get { throw null; } } - public bool IsDataAction { get { throw null; } } + public SynapsePermission(System.Collections.Generic.IList actions, System.Collections.Generic.IList notActions, System.Collections.Generic.IList dataActions, System.Collections.Generic.IList notDataActions) { } + public System.Collections.Generic.IList Actions { get { throw null; } } + public System.Collections.Generic.IList DataActions { get { throw null; } } + public System.Collections.Generic.IList NotActions { get { throw null; } } + public System.Collections.Generic.IList NotDataActions { get { throw null; } } + public static implicit operator Azure.Core.RequestContent (Azure.Analytics.Synapse.AccessControl.SynapsePermission permission) { throw null; } } - public partial class RoleAssignmentDetails + public partial class SynapseRoleAssignment { - internal RoleAssignmentDetails() { } + public SynapseRoleAssignment(string id, Azure.Analytics.Synapse.AccessControl.SynapseRoleAssignmentProperties properties) { } public string Id { get { throw null; } } - public System.Guid? PrincipalId { get { throw null; } } - public string PrincipalType { get { throw null; } } - public System.Guid? RoleDefinitionId { get { throw null; } } - public string Scope { get { throw null; } } - } - public partial class RoleAssignmentDetailsList - { - internal RoleAssignmentDetailsList() { } - public int? Count { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + public Azure.Analytics.Synapse.AccessControl.SynapseRoleAssignmentProperties Properties { get { throw null; } } + public static implicit operator Azure.Core.RequestContent (Azure.Analytics.Synapse.AccessControl.SynapseRoleAssignment value) { throw null; } } - public partial class SubjectInfo + public partial class SynapseRoleAssignmentProperties { - public SubjectInfo(System.Guid principalId) { } - public System.Collections.Generic.IList GroupIds { get { throw null; } } - public System.Guid PrincipalId { get { throw null; } } - } - public partial class SynapseRbacPermission - { - internal SynapseRbacPermission() { } - public System.Collections.Generic.IReadOnlyList Actions { get { throw null; } } - public System.Collections.Generic.IReadOnlyList DataActions { get { throw null; } } - public System.Collections.Generic.IReadOnlyList NotActions { get { throw null; } } - public System.Collections.Generic.IReadOnlyList NotDataActions { get { throw null; } } + public SynapseRoleAssignmentProperties(string principalId, string roleDefinitionId, Azure.Analytics.Synapse.AccessControl.SynapseRoleScope? scope = default(Azure.Analytics.Synapse.AccessControl.SynapseRoleScope?)) { } + public string PrincipalId { get { throw null; } } + public string RoleDefinitionId { get { throw null; } } + public Azure.Analytics.Synapse.AccessControl.SynapseRoleScope? Scope { get { throw null; } } + public static implicit operator Azure.Core.RequestContent (Azure.Analytics.Synapse.AccessControl.SynapseRoleAssignmentProperties value) { throw null; } } public partial class SynapseRoleDefinition { - internal SynapseRoleDefinition() { } - public string AvailabilityStatus { get { throw null; } } - public string Description { get { throw null; } } - public System.Guid? Id { get { throw null; } } - public bool? IsBuiltIn { get { throw null; } } + public SynapseRoleDefinition(string id, string name, string description, System.Collections.Generic.IList permissions, System.Collections.Generic.IList assignableScopes) { } + public System.Collections.Generic.IList AssignableScopes { get { throw null; } } + public string Description { get { throw null; } set { } } + public string Id { get { throw null; } } public string Name { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Permissions { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Scopes { get { throw null; } } + public System.Collections.Generic.IList Permissions { get { throw null; } } + public static implicit operator Azure.Core.RequestContent (Azure.Analytics.Synapse.AccessControl.SynapseRoleDefinition value) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SynapseRoleScope : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SynapseRoleScope(string value) { throw null; } + public static Azure.Analytics.Synapse.AccessControl.SynapseRoleScope Global { get { throw null; } } + public bool Equals(Azure.Analytics.Synapse.AccessControl.SynapseRoleScope 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.Analytics.Synapse.AccessControl.SynapseRoleScope left, Azure.Analytics.Synapse.AccessControl.SynapseRoleScope right) { throw null; } + public static implicit operator Azure.Core.RequestContent (Azure.Analytics.Synapse.AccessControl.SynapseRoleScope scope) { throw null; } + public static implicit operator Azure.Analytics.Synapse.AccessControl.SynapseRoleScope (string value) { throw null; } + public static bool operator !=(Azure.Analytics.Synapse.AccessControl.SynapseRoleScope left, Azure.Analytics.Synapse.AccessControl.SynapseRoleScope right) { throw null; } + public override string ToString() { throw null; } } } diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Azure.Analytics.Synapse.AccessControl.csproj b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Azure.Analytics.Synapse.AccessControl.csproj index 9ef987c263ad..497eb0123dee 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Azure.Analytics.Synapse.AccessControl.csproj +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Azure.Analytics.Synapse.AccessControl.csproj @@ -1,4 +1,4 @@ - + This is the Microsoft Azure Synapse Analytics Access Control client library Azure.Analytics.Synapse.AccessControl @@ -18,7 +18,6 @@ - @@ -37,5 +36,9 @@ + + + + diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/AccessControlModelFactory.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/AccessControlModelFactory.cs deleted file mode 100644 index 1337c400fcf2..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/AccessControlModelFactory.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - /// Model factory for read-only models. - public static partial class AccessControlModelFactory - { - /// Initializes a new instance of CheckPrincipalAccessResponse. - /// To check if the current user, group, or service principal has permission to read artifacts in the specified workspace. - /// A new instance for mocking. - public static CheckPrincipalAccessResponse CheckPrincipalAccessResponse(IEnumerable accessDecisions = null) - { - accessDecisions ??= new List(); - - return new CheckPrincipalAccessResponse(accessDecisions?.ToList()); - } - - /// Initializes a new instance of CheckAccessDecision. - /// Access Decision. - /// Action Id. - /// Role Assignment response details. - /// A new instance for mocking. - public static CheckAccessDecision CheckAccessDecision(string accessDecision = null, string actionId = null, RoleAssignmentDetails roleAssignment = null) - { - return new CheckAccessDecision(accessDecision, actionId, roleAssignment); - } - - /// Initializes a new instance of RoleAssignmentDetails. - /// Role Assignment ID. - /// Role ID of the Synapse Built-In Role. - /// Object ID of the AAD principal or security-group. - /// Scope at the role assignment is created. - /// Type of the principal Id: User, Group or ServicePrincipal. - /// A new instance for mocking. - public static RoleAssignmentDetails RoleAssignmentDetails(string id = null, Guid? roleDefinitionId = null, Guid? principalId = null, string scope = null, string principalType = null) - { - return new RoleAssignmentDetails(id, roleDefinitionId, principalId, scope, principalType); - } - - /// Initializes a new instance of RoleAssignmentDetailsList. - /// Number of role assignments. - /// A list of role assignments. - /// A new instance for mocking. - public static RoleAssignmentDetailsList RoleAssignmentDetailsList(int? count = null, IEnumerable value = null) - { - value ??= new List(); - - return new RoleAssignmentDetailsList(count, value?.ToList()); - } - - /// Initializes a new instance of SynapseRoleDefinition. - /// Role Definition ID. - /// Name of the Synapse role. - /// Is a built-in role or not. - /// Description for the Synapse role. - /// Permissions for the Synapse role. - /// Allowed scopes for the Synapse role. - /// Availability of the Synapse role. - /// A new instance for mocking. - public static SynapseRoleDefinition SynapseRoleDefinition(Guid? id = null, string name = null, bool? isBuiltIn = null, string description = null, IEnumerable permissions = null, IEnumerable scopes = null, string availabilityStatus = null) - { - permissions ??= new List(); - scopes ??= new List(); - - return new SynapseRoleDefinition(id, name, isBuiltIn, description, permissions?.ToList(), scopes?.ToList(), availabilityStatus); - } - - /// Initializes a new instance of SynapseRbacPermission. - /// List of actions. - /// List of Not actions. - /// List of data actions. - /// List of Not data actions. - /// A new instance for mocking. - public static SynapseRbacPermission SynapseRbacPermission(IEnumerable actions = null, IEnumerable notActions = null, IEnumerable dataActions = null, IEnumerable notDataActions = null) - { - actions ??= new List(); - notActions ??= new List(); - dataActions ??= new List(); - notDataActions ??= new List(); - - return new SynapseRbacPermission(actions?.ToList(), notActions?.ToList(), dataActions?.ToList(), notDataActions?.ToList()); - } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/CheckAccessDecision.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/CheckAccessDecision.Serialization.cs deleted file mode 100644 index 92d2c1394b45..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/CheckAccessDecision.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - public partial class CheckAccessDecision - { - internal static CheckAccessDecision DeserializeCheckAccessDecision(JsonElement element) - { - Optional accessDecision = default; - Optional actionId = default; - Optional roleAssignment = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("accessDecision")) - { - accessDecision = property.Value.GetString(); - continue; - } - if (property.NameEquals("actionId")) - { - actionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("roleAssignment")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - roleAssignment = RoleAssignmentDetails.DeserializeRoleAssignmentDetails(property.Value); - continue; - } - } - return new CheckAccessDecision(accessDecision.Value, actionId.Value, roleAssignment.Value); - } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/CheckAccessDecision.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/CheckAccessDecision.cs deleted file mode 100644 index dd571219fdfd..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/CheckAccessDecision.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - /// Check access response details. - public partial class CheckAccessDecision - { - /// Initializes a new instance of CheckAccessDecision. - internal CheckAccessDecision() - { - } - - /// Initializes a new instance of CheckAccessDecision. - /// Access Decision. - /// Action Id. - /// Role Assignment response details. - internal CheckAccessDecision(string accessDecision, string actionId, RoleAssignmentDetails roleAssignment) - { - AccessDecision = accessDecision; - ActionId = actionId; - RoleAssignment = roleAssignment; - } - - /// Access Decision. - public string AccessDecision { get; } - /// Action Id. - public string ActionId { get; } - /// Role Assignment response details. - public RoleAssignmentDetails RoleAssignment { get; } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/CheckPrincipalAccessRequest.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/CheckPrincipalAccessRequest.Serialization.cs deleted file mode 100644 index dac7c0363422..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/CheckPrincipalAccessRequest.Serialization.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - internal partial class CheckPrincipalAccessRequest : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("subject"); - writer.WriteObjectValue(Subject); - writer.WritePropertyName("actions"); - writer.WriteStartArray(); - foreach (var item in Actions) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("scope"); - writer.WriteStringValue(Scope); - writer.WriteEndObject(); - } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/CheckPrincipalAccessRequest.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/CheckPrincipalAccessRequest.cs deleted file mode 100644 index 35bbb2d41230..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/CheckPrincipalAccessRequest.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - /// Check access request details. - internal partial class CheckPrincipalAccessRequest - { - /// Initializes a new instance of CheckPrincipalAccessRequest. - /// Subject details. - /// List of actions. - /// Scope at which the check access is done. - /// , , or is null. - public CheckPrincipalAccessRequest(SubjectInfo subject, IEnumerable actions, string scope) - { - if (subject == null) - { - throw new ArgumentNullException(nameof(subject)); - } - if (actions == null) - { - throw new ArgumentNullException(nameof(actions)); - } - if (scope == null) - { - throw new ArgumentNullException(nameof(scope)); - } - - Subject = subject; - Actions = actions.ToList(); - Scope = scope; - } - - /// Subject details. - public SubjectInfo Subject { get; } - /// List of actions. - public IList Actions { get; } - /// Scope at which the check access is done. - public string Scope { get; } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/CheckPrincipalAccessResponse.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/CheckPrincipalAccessResponse.Serialization.cs deleted file mode 100644 index b7be2dbc9086..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/CheckPrincipalAccessResponse.Serialization.cs +++ /dev/null @@ -1,40 +0,0 @@ -// 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.Analytics.Synapse.AccessControl.Models -{ - public partial class CheckPrincipalAccessResponse - { - internal static CheckPrincipalAccessResponse DeserializeCheckPrincipalAccessResponse(JsonElement element) - { - Optional> accessDecisions = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("accessDecisions")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(CheckAccessDecision.DeserializeCheckAccessDecision(item)); - } - accessDecisions = array; - continue; - } - } - return new CheckPrincipalAccessResponse(Optional.ToList(accessDecisions)); - } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/CheckPrincipalAccessResponse.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/CheckPrincipalAccessResponse.cs deleted file mode 100644 index 374d4c2ab54c..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/CheckPrincipalAccessResponse.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - /// Check access response details. - public partial class CheckPrincipalAccessResponse - { - /// Initializes a new instance of CheckPrincipalAccessResponse. - internal CheckPrincipalAccessResponse() - { - AccessDecisions = new ChangeTrackingList(); - } - - /// Initializes a new instance of CheckPrincipalAccessResponse. - /// To check if the current user, group, or service principal has permission to read artifacts in the specified workspace. - internal CheckPrincipalAccessResponse(IReadOnlyList accessDecisions) - { - AccessDecisions = accessDecisions; - } - - /// To check if the current user, group, or service principal has permission to read artifacts in the specified workspace. - public IReadOnlyList AccessDecisions { get; } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs deleted file mode 100644 index ef28e0ae679d..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - internal partial class ErrorAdditionalInfo - { - internal static ErrorAdditionalInfo DeserializeErrorAdditionalInfo(JsonElement element) - { - Optional type = default; - Optional info = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("info")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - info = property.Value.GetObject(); - continue; - } - } - return new ErrorAdditionalInfo(type.Value, info.Value); - } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/ErrorAdditionalInfo.cs deleted file mode 100644 index 34f98258af01..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/ErrorAdditionalInfo.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - /// The resource management error additional info. - internal partial class ErrorAdditionalInfo - { - /// Initializes a new instance of ErrorAdditionalInfo. - internal ErrorAdditionalInfo() - { - } - - /// Initializes a new instance of ErrorAdditionalInfo. - /// The additional info type. - /// The additional info. - internal ErrorAdditionalInfo(string type, object info) - { - Type = type; - Info = info; - } - - /// The additional info type. - public string Type { get; } - /// The additional info. - public object Info { get; } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/ErrorContract.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/ErrorContract.Serialization.cs deleted file mode 100644 index 3cf0dc1c9e25..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/ErrorContract.Serialization.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - internal partial class ErrorContract - { - internal static ErrorContract DeserializeErrorContract(JsonElement element) - { - Optional error = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("error")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - error = ErrorResponse.DeserializeErrorResponse(property.Value); - continue; - } - } - return new ErrorContract(error.Value); - } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/ErrorContract.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/ErrorContract.cs deleted file mode 100644 index 4fb88b234f4e..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/ErrorContract.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - /// Contains details when the response code indicates an error. - internal partial class ErrorContract - { - /// Initializes a new instance of ErrorContract. - internal ErrorContract() - { - } - - /// Initializes a new instance of ErrorContract. - /// The error details. - internal ErrorContract(ErrorResponse error) - { - Error = error; - } - - /// The error details. - public ErrorResponse Error { get; } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/ErrorResponse.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/ErrorResponse.Serialization.cs deleted file mode 100644 index 0ce5e8390747..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/ErrorResponse.Serialization.cs +++ /dev/null @@ -1,74 +0,0 @@ -// 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.Analytics.Synapse.AccessControl.Models -{ - internal partial class ErrorResponse - { - internal static ErrorResponse DeserializeErrorResponse(JsonElement element) - { - Optional code = default; - Optional message = default; - Optional target = default; - Optional> details = default; - Optional> additionalInfo = 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("target")) - { - target = property.Value.GetString(); - continue; - } - if (property.NameEquals("details")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(DeserializeErrorResponse(item)); - } - details = array; - continue; - } - if (property.NameEquals("additionalInfo")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ErrorAdditionalInfo.DeserializeErrorAdditionalInfo(item)); - } - additionalInfo = array; - continue; - } - } - return new ErrorResponse(code.Value, message.Value, target.Value, Optional.ToList(details), Optional.ToList(additionalInfo)); - } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/ErrorResponse.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/ErrorResponse.cs deleted file mode 100644 index 8fa98e446948..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/ErrorResponse.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - /// Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - internal partial class ErrorResponse - { - /// Initializes a new instance of ErrorResponse. - internal ErrorResponse() - { - Details = new ChangeTrackingList(); - AdditionalInfo = new ChangeTrackingList(); - } - - /// Initializes a new instance of ErrorResponse. - /// The error code. - /// The error message. - /// The error target. - /// The error details. - /// The error additional info. - internal ErrorResponse(string code, string message, string target, IReadOnlyList details, IReadOnlyList additionalInfo) - { - Code = code; - Message = message; - Target = target; - Details = details; - AdditionalInfo = additionalInfo; - } - - /// The error code. - public string Code { get; } - /// The error message. - public string Message { get; } - /// The error target. - public string Target { get; } - /// The error details. - public IReadOnlyList Details { get; } - /// The error additional info. - public IReadOnlyList AdditionalInfo { get; } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RequiredAction.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RequiredAction.Serialization.cs deleted file mode 100644 index fb9923e1c8ad..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RequiredAction.Serialization.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - public partial class RequiredAction : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); - writer.WritePropertyName("isDataAction"); - writer.WriteBooleanValue(IsDataAction); - writer.WriteEndObject(); - } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RequiredAction.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RequiredAction.cs deleted file mode 100644 index 4661ac9aa893..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RequiredAction.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - /// Action Info. - public partial class RequiredAction - { - /// Initializes a new instance of RequiredAction. - /// Action Id. - /// Is a data action or not. - /// is null. - public RequiredAction(string id, bool isDataAction) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - Id = id; - IsDataAction = isDataAction; - } - - /// Action Id. - public string Id { get; } - /// Is a data action or not. - public bool IsDataAction { get; } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RoleAssignmentDetails.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RoleAssignmentDetails.Serialization.cs deleted file mode 100644 index 9641eae35a62..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RoleAssignmentDetails.Serialization.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - public partial class RoleAssignmentDetails - { - internal static RoleAssignmentDetails DeserializeRoleAssignmentDetails(JsonElement element) - { - Optional id = default; - Optional roleDefinitionId = default; - Optional principalId = default; - Optional scope = default; - Optional principalType = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("roleDefinitionId")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - roleDefinitionId = property.Value.GetGuid(); - continue; - } - if (property.NameEquals("principalId")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - principalId = property.Value.GetGuid(); - continue; - } - if (property.NameEquals("scope")) - { - scope = property.Value.GetString(); - continue; - } - if (property.NameEquals("principalType")) - { - principalType = property.Value.GetString(); - continue; - } - } - return new RoleAssignmentDetails(id.Value, Optional.ToNullable(roleDefinitionId), Optional.ToNullable(principalId), scope.Value, principalType.Value); - } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RoleAssignmentDetails.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RoleAssignmentDetails.cs deleted file mode 100644 index f2a675054284..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RoleAssignmentDetails.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - /// Role Assignment response details. - public partial class RoleAssignmentDetails - { - /// Initializes a new instance of RoleAssignmentDetails. - internal RoleAssignmentDetails() - { - } - - /// Initializes a new instance of RoleAssignmentDetails. - /// Role Assignment ID. - /// Role ID of the Synapse Built-In Role. - /// Object ID of the AAD principal or security-group. - /// Scope at the role assignment is created. - /// Type of the principal Id: User, Group or ServicePrincipal. - internal RoleAssignmentDetails(string id, Guid? roleDefinitionId, Guid? principalId, string scope, string principalType) - { - Id = id; - RoleDefinitionId = roleDefinitionId; - PrincipalId = principalId; - Scope = scope; - PrincipalType = principalType; - } - - /// Role Assignment ID. - public string Id { get; } - /// Role ID of the Synapse Built-In Role. - public Guid? RoleDefinitionId { get; } - /// Object ID of the AAD principal or security-group. - public Guid? PrincipalId { get; } - /// Scope at the role assignment is created. - public string Scope { get; } - /// Type of the principal Id: User, Group or ServicePrincipal. - public string PrincipalType { get; } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RoleAssignmentDetailsList.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RoleAssignmentDetailsList.Serialization.cs deleted file mode 100644 index d8f3f5f94096..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RoleAssignmentDetailsList.Serialization.cs +++ /dev/null @@ -1,51 +0,0 @@ -// 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.Analytics.Synapse.AccessControl.Models -{ - public partial class RoleAssignmentDetailsList - { - internal static RoleAssignmentDetailsList DeserializeRoleAssignmentDetailsList(JsonElement element) - { - Optional count = default; - Optional> value = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("count")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - count = property.Value.GetInt32(); - 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(RoleAssignmentDetails.DeserializeRoleAssignmentDetails(item)); - } - value = array; - continue; - } - } - return new RoleAssignmentDetailsList(Optional.ToNullable(count), Optional.ToList(value)); - } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RoleAssignmentDetailsList.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RoleAssignmentDetailsList.cs deleted file mode 100644 index a38abc8593eb..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RoleAssignmentDetailsList.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - /// Role Assignment response details. - public partial class RoleAssignmentDetailsList - { - /// Initializes a new instance of RoleAssignmentDetailsList. - internal RoleAssignmentDetailsList() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of RoleAssignmentDetailsList. - /// Number of role assignments. - /// A list of role assignments. - internal RoleAssignmentDetailsList(int? count, IReadOnlyList value) - { - Count = count; - Value = value; - } - - /// Number of role assignments. - public int? Count { get; } - /// A list of role assignments. - public IReadOnlyList Value { get; } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RoleAssignmentRequest.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RoleAssignmentRequest.Serialization.cs deleted file mode 100644 index 1569c67da082..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RoleAssignmentRequest.Serialization.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - internal partial class RoleAssignmentRequest : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("roleId"); - writer.WriteStringValue(RoleId); - writer.WritePropertyName("principalId"); - writer.WriteStringValue(PrincipalId); - writer.WritePropertyName("scope"); - writer.WriteStringValue(Scope); - if (Optional.IsDefined(PrincipalType)) - { - writer.WritePropertyName("principalType"); - writer.WriteStringValue(PrincipalType); - } - writer.WriteEndObject(); - } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RoleAssignmentRequest.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RoleAssignmentRequest.cs deleted file mode 100644 index 112caba12217..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/RoleAssignmentRequest.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - /// Role Assignment request details. - internal partial class RoleAssignmentRequest - { - /// Initializes a new instance of RoleAssignmentRequest. - /// Role ID of the Synapse Built-In Role. - /// Object ID of the AAD principal or security-group. - /// Scope at which the role assignment is created. - /// is null. - public RoleAssignmentRequest(Guid roleId, Guid principalId, string scope) - { - if (scope == null) - { - throw new ArgumentNullException(nameof(scope)); - } - - RoleId = roleId; - PrincipalId = principalId; - Scope = scope; - } - - /// Role ID of the Synapse Built-In Role. - public Guid RoleId { get; } - /// Object ID of the AAD principal or security-group. - public Guid PrincipalId { get; } - /// Scope at which the role assignment is created. - public string Scope { get; } - /// Type of the principal Id: User, Group or ServicePrincipal. - public string PrincipalType { get; set; } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/SubjectInfo.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/SubjectInfo.Serialization.cs deleted file mode 100644 index c7e3a7dd1103..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/SubjectInfo.Serialization.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - public partial class SubjectInfo : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("principalId"); - writer.WriteStringValue(PrincipalId); - if (Optional.IsCollectionDefined(GroupIds)) - { - writer.WritePropertyName("groupIds"); - writer.WriteStartArray(); - foreach (var item in GroupIds) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/SubjectInfo.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/SubjectInfo.cs deleted file mode 100644 index 81f228090d63..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/SubjectInfo.cs +++ /dev/null @@ -1,30 +0,0 @@ -// 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.Analytics.Synapse.AccessControl.Models -{ - /// Subject details. - public partial class SubjectInfo - { - /// Initializes a new instance of SubjectInfo. - /// Principal Id. - public SubjectInfo(Guid principalId) - { - PrincipalId = principalId; - GroupIds = new ChangeTrackingList(); - } - - /// Principal Id. - public Guid PrincipalId { get; } - /// List of group Ids that the principalId is part of. - public IList GroupIds { get; } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/SynapseRbacPermission.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/SynapseRbacPermission.Serialization.cs deleted file mode 100644 index 74949e8ffc23..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/SynapseRbacPermission.Serialization.cs +++ /dev/null @@ -1,88 +0,0 @@ -// 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.Analytics.Synapse.AccessControl.Models -{ - public partial class SynapseRbacPermission - { - internal static SynapseRbacPermission DeserializeSynapseRbacPermission(JsonElement element) - { - Optional> actions = default; - Optional> notActions = default; - Optional> dataActions = default; - Optional> notDataActions = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("actions")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - actions = array; - continue; - } - if (property.NameEquals("notActions")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - notActions = array; - continue; - } - if (property.NameEquals("dataActions")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - dataActions = array; - continue; - } - if (property.NameEquals("notDataActions")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - notDataActions = array; - continue; - } - } - return new SynapseRbacPermission(Optional.ToList(actions), Optional.ToList(notActions), Optional.ToList(dataActions), Optional.ToList(notDataActions)); - } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/SynapseRbacPermission.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/SynapseRbacPermission.cs deleted file mode 100644 index 5b54c4e920e3..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/SynapseRbacPermission.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.Analytics.Synapse.AccessControl.Models -{ - /// Synapse role definition details. - public partial class SynapseRbacPermission - { - /// Initializes a new instance of SynapseRbacPermission. - internal SynapseRbacPermission() - { - Actions = new ChangeTrackingList(); - NotActions = new ChangeTrackingList(); - DataActions = new ChangeTrackingList(); - NotDataActions = new ChangeTrackingList(); - } - - /// Initializes a new instance of SynapseRbacPermission. - /// List of actions. - /// List of Not actions. - /// List of data actions. - /// List of Not data actions. - internal SynapseRbacPermission(IReadOnlyList actions, IReadOnlyList notActions, IReadOnlyList dataActions, IReadOnlyList notDataActions) - { - Actions = actions; - NotActions = notActions; - DataActions = dataActions; - NotDataActions = notDataActions; - } - - /// List of actions. - public IReadOnlyList Actions { get; } - /// List of Not actions. - public IReadOnlyList NotActions { get; } - /// List of data actions. - public IReadOnlyList DataActions { get; } - /// List of Not data actions. - public IReadOnlyList NotDataActions { get; } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/SynapseRoleDefinition.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/SynapseRoleDefinition.Serialization.cs deleted file mode 100644 index e9ac515279c2..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/SynapseRoleDefinition.Serialization.cs +++ /dev/null @@ -1,97 +0,0 @@ -// 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.Analytics.Synapse.AccessControl.Models -{ - public partial class SynapseRoleDefinition - { - internal static SynapseRoleDefinition DeserializeSynapseRoleDefinition(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional isBuiltIn = default; - Optional description = default; - Optional> permissions = default; - Optional> scopes = default; - Optional availabilityStatus = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - id = property.Value.GetGuid(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("isBuiltIn")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - isBuiltIn = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("description")) - { - description = 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(SynapseRbacPermission.DeserializeSynapseRbacPermission(item)); - } - permissions = array; - continue; - } - if (property.NameEquals("scopes")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - scopes = array; - continue; - } - if (property.NameEquals("availabilityStatus")) - { - availabilityStatus = property.Value.GetString(); - continue; - } - } - return new SynapseRoleDefinition(Optional.ToNullable(id), name.Value, Optional.ToNullable(isBuiltIn), description.Value, Optional.ToList(permissions), Optional.ToList(scopes), availabilityStatus.Value); - } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/SynapseRoleDefinition.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/SynapseRoleDefinition.cs deleted file mode 100644 index 97371237eaa3..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/Models/SynapseRoleDefinition.cs +++ /dev/null @@ -1,58 +0,0 @@ -// 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.Analytics.Synapse.AccessControl.Models -{ - /// Synapse role definition details. - public partial class SynapseRoleDefinition - { - /// Initializes a new instance of SynapseRoleDefinition. - internal SynapseRoleDefinition() - { - Permissions = new ChangeTrackingList(); - Scopes = new ChangeTrackingList(); - } - - /// Initializes a new instance of SynapseRoleDefinition. - /// Role Definition ID. - /// Name of the Synapse role. - /// Is a built-in role or not. - /// Description for the Synapse role. - /// Permissions for the Synapse role. - /// Allowed scopes for the Synapse role. - /// Availability of the Synapse role. - internal SynapseRoleDefinition(Guid? id, string name, bool? isBuiltIn, string description, IReadOnlyList permissions, IReadOnlyList scopes, string availabilityStatus) - { - Id = id; - Name = name; - IsBuiltIn = isBuiltIn; - Description = description; - Permissions = permissions; - Scopes = scopes; - AvailabilityStatus = availabilityStatus; - } - - /// Role Definition ID. - public Guid? Id { get; } - /// Name of the Synapse role. - public string Name { get; } - /// Is a built-in role or not. - public bool? IsBuiltIn { get; } - /// Description for the Synapse role. - public string Description { get; } - /// Permissions for the Synapse role. - public IReadOnlyList Permissions { get; } - /// Allowed scopes for the Synapse role. - public IReadOnlyList Scopes { get; } - /// Availability of the Synapse role. - public string AvailabilityStatus { get; } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleAssignmentsClient.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleAssignmentsClient.cs deleted file mode 100644 index b8d844c8eda3..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleAssignmentsClient.cs +++ /dev/null @@ -1,265 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Analytics.Synapse.AccessControl.Models; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.Analytics.Synapse.AccessControl -{ - /// The RoleAssignments service client. - public partial class RoleAssignmentsClient - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal RoleAssignmentsRestClient RestClient { get; } - - /// Initializes a new instance of RoleAssignmentsClient for mocking. - protected RoleAssignmentsClient() - { - } - - /// Initializes a new instance of RoleAssignmentsClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - public RoleAssignmentsClient(Uri endpoint, TokenCredential credential, AccessControlClientOptions options = null) - { - if (endpoint == null) - { - throw new ArgumentNullException(nameof(endpoint)); - } - if (credential == null) - { - throw new ArgumentNullException(nameof(credential)); - } - - options ??= new AccessControlClientOptions(); - _clientDiagnostics = new ClientDiagnostics(options); - string[] scopes = { "https://dev.azuresynapse.net/.default" }; - _pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, scopes)); - RestClient = new RoleAssignmentsRestClient(_clientDiagnostics, _pipeline, endpoint, options.Version); - } - - /// Initializes a new instance of RoleAssignmentsClient. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. - /// Api Version. - internal RoleAssignmentsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion = "2020-12-01") - { - RestClient = new RoleAssignmentsRestClient(clientDiagnostics, pipeline, endpoint, apiVersion); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Check if the given principalId has access to perform list of actions at a given scope. - /// Subject details. - /// List of actions. - /// Scope at which the check access is done. - /// The cancellation token to use. - public virtual async Task> CheckPrincipalAccessAsync(SubjectInfo subject, IEnumerable actions, string scope, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsClient.CheckPrincipalAccess"); - scope0.Start(); - try - { - return await RestClient.CheckPrincipalAccessAsync(subject, actions, scope, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Check if the given principalId has access to perform list of actions at a given scope. - /// Subject details. - /// List of actions. - /// Scope at which the check access is done. - /// The cancellation token to use. - public virtual Response CheckPrincipalAccess(SubjectInfo subject, IEnumerable actions, string scope, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsClient.CheckPrincipalAccess"); - scope0.Start(); - try - { - return RestClient.CheckPrincipalAccess(subject, actions, scope, cancellationToken); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// List role assignments. - /// Synapse Built-In Role Id. - /// Object ID of the AAD principal or security-group. - /// Scope of the Synapse Built-in Role. - /// Continuation token. - /// The cancellation token to use. - public virtual async Task> ListRoleAssignmentsAsync(string roleId = null, string principalId = null, string scope = null, string continuationToken = null, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsClient.ListRoleAssignments"); - scope0.Start(); - try - { - return await RestClient.ListRoleAssignmentsAsync(roleId, principalId, scope, continuationToken, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// List role assignments. - /// Synapse Built-In Role Id. - /// Object ID of the AAD principal or security-group. - /// Scope of the Synapse Built-in Role. - /// Continuation token. - /// The cancellation token to use. - public virtual Response ListRoleAssignments(string roleId = null, string principalId = null, string scope = null, string continuationToken = null, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsClient.ListRoleAssignments"); - scope0.Start(); - try - { - return RestClient.ListRoleAssignments(roleId, principalId, scope, continuationToken, cancellationToken); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Create role assignment. - /// The ID of the role assignment. - /// Role ID of the Synapse Built-In Role. - /// Object ID of the AAD principal or security-group. - /// Scope at which the role assignment is created. - /// Type of the principal Id: User, Group or ServicePrincipal. - /// The cancellation token to use. - public virtual async Task> CreateRoleAssignmentAsync(string roleAssignmentId, Guid roleId, Guid principalId, string scope, string principalType = null, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsClient.CreateRoleAssignment"); - scope0.Start(); - try - { - return await RestClient.CreateRoleAssignmentAsync(roleAssignmentId, roleId, principalId, scope, principalType, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Create role assignment. - /// The ID of the role assignment. - /// Role ID of the Synapse Built-In Role. - /// Object ID of the AAD principal or security-group. - /// Scope at which the role assignment is created. - /// Type of the principal Id: User, Group or ServicePrincipal. - /// The cancellation token to use. - public virtual Response CreateRoleAssignment(string roleAssignmentId, Guid roleId, Guid principalId, string scope, string principalType = null, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsClient.CreateRoleAssignment"); - scope0.Start(); - try - { - return RestClient.CreateRoleAssignment(roleAssignmentId, roleId, principalId, scope, principalType, cancellationToken); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Get role assignment by role assignment Id. - /// The ID of the role assignment. - /// The cancellation token to use. - public virtual async Task> GetRoleAssignmentByIdAsync(string roleAssignmentId, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsClient.GetRoleAssignmentById"); - scope0.Start(); - try - { - return await RestClient.GetRoleAssignmentByIdAsync(roleAssignmentId, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Get role assignment by role assignment Id. - /// The ID of the role assignment. - /// The cancellation token to use. - public virtual Response GetRoleAssignmentById(string roleAssignmentId, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsClient.GetRoleAssignmentById"); - scope0.Start(); - try - { - return RestClient.GetRoleAssignmentById(roleAssignmentId, cancellationToken); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Delete role assignment by role assignment Id. - /// The ID of the role assignment. - /// Scope of the Synapse Built-in Role. - /// The cancellation token to use. - public virtual async Task DeleteRoleAssignmentByIdAsync(string roleAssignmentId, string scope = null, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsClient.DeleteRoleAssignmentById"); - scope0.Start(); - try - { - return await RestClient.DeleteRoleAssignmentByIdAsync(roleAssignmentId, scope, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Delete role assignment by role assignment Id. - /// The ID of the role assignment. - /// Scope of the Synapse Built-in Role. - /// The cancellation token to use. - public virtual Response DeleteRoleAssignmentById(string roleAssignmentId, string scope = null, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsClient.DeleteRoleAssignmentById"); - scope0.Start(); - try - { - return RestClient.DeleteRoleAssignmentById(roleAssignmentId, scope, cancellationToken); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleAssignmentsListRoleAssignmentsHeaders.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleAssignmentsListRoleAssignmentsHeaders.cs deleted file mode 100644 index ea5f12d1c397..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleAssignmentsListRoleAssignmentsHeaders.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure; -using Azure.Core; - -namespace Azure.Analytics.Synapse.AccessControl -{ - internal partial class RoleAssignmentsListRoleAssignmentsHeaders - { - private readonly Response _response; - public RoleAssignmentsListRoleAssignmentsHeaders(Response response) - { - _response = response; - } - /// If the number of role assignments to be listed exceeds the maxResults limit, a continuation token is returned in this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation of the list operation to continue listing the role assignments. - public string XMsContinuation => _response.Headers.TryGetValue("x-ms-continuation", out string value) ? value : null; - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleAssignmentsRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleAssignmentsRestClient.cs deleted file mode 100644 index 600a8ef6d451..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleAssignmentsRestClient.cs +++ /dev/null @@ -1,444 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Analytics.Synapse.AccessControl.Models; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.Analytics.Synapse.AccessControl -{ - internal partial class RoleAssignmentsRestClient - { - private Uri endpoint; - private string apiVersion; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of RoleAssignmentsRestClient. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. - /// Api Version. - /// or is null. - public RoleAssignmentsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion = "2020-12-01") - { - this.endpoint = endpoint ?? throw new ArgumentNullException(nameof(endpoint)); - this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateCheckPrincipalAccessRequest(SubjectInfo subject, IEnumerable actions, string scope) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/checkAccessSynapseRbac", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json, text/json"); - request.Headers.Add("Content-Type", "application/json"); - var model = new CheckPrincipalAccessRequest(subject, actions.ToList(), scope); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; - return message; - } - - /// Check if the given principalId has access to perform list of actions at a given scope. - /// Subject details. - /// List of actions. - /// Scope at which the check access is done. - /// The cancellation token to use. - /// , , or is null. - public async Task> CheckPrincipalAccessAsync(SubjectInfo subject, IEnumerable actions, string scope, CancellationToken cancellationToken = default) - { - if (subject == null) - { - throw new ArgumentNullException(nameof(subject)); - } - if (actions == null) - { - throw new ArgumentNullException(nameof(actions)); - } - if (scope == null) - { - throw new ArgumentNullException(nameof(scope)); - } - - using var message = CreateCheckPrincipalAccessRequest(subject, actions, scope); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - CheckPrincipalAccessResponse value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = CheckPrincipalAccessResponse.DeserializeCheckPrincipalAccessResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Check if the given principalId has access to perform list of actions at a given scope. - /// Subject details. - /// List of actions. - /// Scope at which the check access is done. - /// The cancellation token to use. - /// , , or is null. - public Response CheckPrincipalAccess(SubjectInfo subject, IEnumerable actions, string scope, CancellationToken cancellationToken = default) - { - if (subject == null) - { - throw new ArgumentNullException(nameof(subject)); - } - if (actions == null) - { - throw new ArgumentNullException(nameof(actions)); - } - if (scope == null) - { - throw new ArgumentNullException(nameof(scope)); - } - - using var message = CreateCheckPrincipalAccessRequest(subject, actions, scope); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - CheckPrincipalAccessResponse value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = CheckPrincipalAccessResponse.DeserializeCheckPrincipalAccessResponse(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListRoleAssignmentsRequest(string roleId, string principalId, string scope, string continuationToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/roleAssignments", false); - uri.AppendQuery("api-version", apiVersion, true); - if (roleId != null) - { - uri.AppendQuery("roleId", roleId, true); - } - if (principalId != null) - { - uri.AppendQuery("principalId", principalId, true); - } - if (scope != null) - { - uri.AppendQuery("scope", scope, true); - } - request.Uri = uri; - if (continuationToken != null) - { - request.Headers.Add("x-ms-continuation", continuationToken); - } - request.Headers.Add("Accept", "application/json, text/json"); - return message; - } - - /// List role assignments. - /// Synapse Built-In Role Id. - /// Object ID of the AAD principal or security-group. - /// Scope of the Synapse Built-in Role. - /// Continuation token. - /// The cancellation token to use. - public async Task> ListRoleAssignmentsAsync(string roleId = null, string principalId = null, string scope = null, string continuationToken = null, CancellationToken cancellationToken = default) - { - using var message = CreateListRoleAssignmentsRequest(roleId, principalId, scope, continuationToken); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - var headers = new RoleAssignmentsListRoleAssignmentsHeaders(message.Response); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentDetailsList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RoleAssignmentDetailsList.DeserializeRoleAssignmentDetailsList(document.RootElement); - return ResponseWithHeaders.FromValue(value, headers, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// List role assignments. - /// Synapse Built-In Role Id. - /// Object ID of the AAD principal or security-group. - /// Scope of the Synapse Built-in Role. - /// Continuation token. - /// The cancellation token to use. - public ResponseWithHeaders ListRoleAssignments(string roleId = null, string principalId = null, string scope = null, string continuationToken = null, CancellationToken cancellationToken = default) - { - using var message = CreateListRoleAssignmentsRequest(roleId, principalId, scope, continuationToken); - _pipeline.Send(message, cancellationToken); - var headers = new RoleAssignmentsListRoleAssignmentsHeaders(message.Response); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentDetailsList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RoleAssignmentDetailsList.DeserializeRoleAssignmentDetailsList(document.RootElement); - return ResponseWithHeaders.FromValue(value, headers, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateCreateRoleAssignmentRequest(string roleAssignmentId, Guid roleId, Guid principalId, string scope, string principalType) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/roleAssignments/", false); - uri.AppendPath(roleAssignmentId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json, text/json"); - request.Headers.Add("Content-Type", "application/json"); - var model = new RoleAssignmentRequest(roleId, principalId, scope) - { - PrincipalType = principalType - }; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; - return message; - } - - /// Create role assignment. - /// The ID of the role assignment. - /// Role ID of the Synapse Built-In Role. - /// Object ID of the AAD principal or security-group. - /// Scope at which the role assignment is created. - /// Type of the principal Id: User, Group or ServicePrincipal. - /// The cancellation token to use. - /// or is null. - public async Task> CreateRoleAssignmentAsync(string roleAssignmentId, Guid roleId, Guid principalId, string scope, string principalType = null, CancellationToken cancellationToken = default) - { - if (roleAssignmentId == null) - { - throw new ArgumentNullException(nameof(roleAssignmentId)); - } - if (scope == null) - { - throw new ArgumentNullException(nameof(scope)); - } - - using var message = CreateCreateRoleAssignmentRequest(roleAssignmentId, roleId, principalId, scope, principalType); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentDetails value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RoleAssignmentDetails.DeserializeRoleAssignmentDetails(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Create role assignment. - /// The ID of the role assignment. - /// Role ID of the Synapse Built-In Role. - /// Object ID of the AAD principal or security-group. - /// Scope at which the role assignment is created. - /// Type of the principal Id: User, Group or ServicePrincipal. - /// The cancellation token to use. - /// or is null. - public Response CreateRoleAssignment(string roleAssignmentId, Guid roleId, Guid principalId, string scope, string principalType = null, CancellationToken cancellationToken = default) - { - if (roleAssignmentId == null) - { - throw new ArgumentNullException(nameof(roleAssignmentId)); - } - if (scope == null) - { - throw new ArgumentNullException(nameof(scope)); - } - - using var message = CreateCreateRoleAssignmentRequest(roleAssignmentId, roleId, principalId, scope, principalType); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentDetails value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RoleAssignmentDetails.DeserializeRoleAssignmentDetails(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetRoleAssignmentByIdRequest(string roleAssignmentId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/roleAssignments/", false); - uri.AppendPath(roleAssignmentId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json, text/json"); - return message; - } - - /// Get role assignment by role assignment Id. - /// The ID of the role assignment. - /// The cancellation token to use. - /// is null. - public async Task> GetRoleAssignmentByIdAsync(string roleAssignmentId, CancellationToken cancellationToken = default) - { - if (roleAssignmentId == null) - { - throw new ArgumentNullException(nameof(roleAssignmentId)); - } - - using var message = CreateGetRoleAssignmentByIdRequest(roleAssignmentId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentDetails value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RoleAssignmentDetails.DeserializeRoleAssignmentDetails(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Get role assignment by role assignment Id. - /// The ID of the role assignment. - /// The cancellation token to use. - /// is null. - public Response GetRoleAssignmentById(string roleAssignmentId, CancellationToken cancellationToken = default) - { - if (roleAssignmentId == null) - { - throw new ArgumentNullException(nameof(roleAssignmentId)); - } - - using var message = CreateGetRoleAssignmentByIdRequest(roleAssignmentId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RoleAssignmentDetails value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RoleAssignmentDetails.DeserializeRoleAssignmentDetails(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateDeleteRoleAssignmentByIdRequest(string roleAssignmentId, string scope) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/roleAssignments/", false); - uri.AppendPath(roleAssignmentId, true); - uri.AppendQuery("api-version", apiVersion, true); - if (scope != null) - { - uri.AppendQuery("scope", scope, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json, text/json"); - return message; - } - - /// Delete role assignment by role assignment Id. - /// The ID of the role assignment. - /// Scope of the Synapse Built-in Role. - /// The cancellation token to use. - /// is null. - public async Task DeleteRoleAssignmentByIdAsync(string roleAssignmentId, string scope = null, CancellationToken cancellationToken = default) - { - if (roleAssignmentId == null) - { - throw new ArgumentNullException(nameof(roleAssignmentId)); - } - - using var message = CreateDeleteRoleAssignmentByIdRequest(roleAssignmentId, scope); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Delete role assignment by role assignment Id. - /// The ID of the role assignment. - /// Scope of the Synapse Built-in Role. - /// The cancellation token to use. - /// is null. - public Response DeleteRoleAssignmentById(string roleAssignmentId, string scope = null, CancellationToken cancellationToken = default) - { - if (roleAssignmentId == null) - { - throw new ArgumentNullException(nameof(roleAssignmentId)); - } - - using var message = CreateDeleteRoleAssignmentByIdRequest(roleAssignmentId, scope); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleDefinitionsClient.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleDefinitionsClient.cs deleted file mode 100644 index 5e16efb1c0b3..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleDefinitionsClient.cs +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Analytics.Synapse.AccessControl.Models; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.Analytics.Synapse.AccessControl -{ - /// The RoleDefinitions service client. - public partial class RoleDefinitionsClient - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal RoleDefinitionsRestClient RestClient { get; } - - /// Initializes a new instance of RoleDefinitionsClient for mocking. - protected RoleDefinitionsClient() - { - } - - /// Initializes a new instance of RoleDefinitionsClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - public RoleDefinitionsClient(Uri endpoint, TokenCredential credential, AccessControlClientOptions options = null) - { - if (endpoint == null) - { - throw new ArgumentNullException(nameof(endpoint)); - } - if (credential == null) - { - throw new ArgumentNullException(nameof(credential)); - } - - options ??= new AccessControlClientOptions(); - _clientDiagnostics = new ClientDiagnostics(options); - string[] scopes = { "https://dev.azuresynapse.net/.default" }; - _pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, scopes)); - RestClient = new RoleDefinitionsRestClient(_clientDiagnostics, _pipeline, endpoint, options.Version); - } - - /// Initializes a new instance of RoleDefinitionsClient. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. - /// Api Version. - internal RoleDefinitionsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion = "2020-12-01") - { - RestClient = new RoleDefinitionsRestClient(clientDiagnostics, pipeline, endpoint, apiVersion); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// List role definitions. - /// Is a Synapse Built-In Role or not. - /// Scope of the Synapse Built-in Role. - /// The cancellation token to use. - public virtual async Task>> ListRoleDefinitionsAsync(bool? isBuiltIn = null, string scope = null, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleDefinitionsClient.ListRoleDefinitions"); - scope0.Start(); - try - { - return await RestClient.ListRoleDefinitionsAsync(isBuiltIn, scope, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// List role definitions. - /// Is a Synapse Built-In Role or not. - /// Scope of the Synapse Built-in Role. - /// The cancellation token to use. - public virtual Response> ListRoleDefinitions(bool? isBuiltIn = null, string scope = null, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleDefinitionsClient.ListRoleDefinitions"); - scope0.Start(); - try - { - return RestClient.ListRoleDefinitions(isBuiltIn, scope, cancellationToken); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Get role definition by role definition Id. - /// Synapse Built-In Role Definition Id. - /// The cancellation token to use. - public virtual async Task> GetRoleDefinitionByIdAsync(string roleDefinitionId, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleDefinitionsClient.GetRoleDefinitionById"); - scope0.Start(); - try - { - return await RestClient.GetRoleDefinitionByIdAsync(roleDefinitionId, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// Get role definition by role definition Id. - /// Synapse Built-In Role Definition Id. - /// The cancellation token to use. - public virtual Response GetRoleDefinitionById(string roleDefinitionId, CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleDefinitionsClient.GetRoleDefinitionById"); - scope0.Start(); - try - { - return RestClient.GetRoleDefinitionById(roleDefinitionId, cancellationToken); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// List rbac scopes. - /// The cancellation token to use. - public virtual async Task>> ListScopesAsync(CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleDefinitionsClient.ListScopes"); - scope0.Start(); - try - { - return await RestClient.ListScopesAsync(cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// List rbac scopes. - /// The cancellation token to use. - public virtual Response> ListScopes(CancellationToken cancellationToken = default) - { - using var scope0 = _clientDiagnostics.CreateScope("RoleDefinitionsClient.ListScopes"); - scope0.Start(); - try - { - return RestClient.ListScopes(cancellationToken); - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleDefinitionsRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleDefinitionsRestClient.cs deleted file mode 100644 index 686134bc8ca8..000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleDefinitionsRestClient.cs +++ /dev/null @@ -1,250 +0,0 @@ -// 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 System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Analytics.Synapse.AccessControl.Models; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.Analytics.Synapse.AccessControl -{ - internal partial class RoleDefinitionsRestClient - { - private Uri endpoint; - private string apiVersion; - private ClientDiagnostics _clientDiagnostics; - private HttpPipeline _pipeline; - - /// Initializes a new instance of RoleDefinitionsRestClient. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. - /// Api Version. - /// or is null. - public RoleDefinitionsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion = "2020-12-01") - { - this.endpoint = endpoint ?? throw new ArgumentNullException(nameof(endpoint)); - this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - internal HttpMessage CreateListRoleDefinitionsRequest(bool? isBuiltIn, string scope) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/roleDefinitions", false); - uri.AppendQuery("api-version", apiVersion, true); - if (isBuiltIn != null) - { - uri.AppendQuery("isBuiltIn", isBuiltIn.Value, true); - } - if (scope != null) - { - uri.AppendQuery("scope", scope, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json, text/json"); - return message; - } - - /// List role definitions. - /// Is a Synapse Built-In Role or not. - /// Scope of the Synapse Built-in Role. - /// The cancellation token to use. - public async Task>> ListRoleDefinitionsAsync(bool? isBuiltIn = null, string scope = null, CancellationToken cancellationToken = default) - { - using var message = CreateListRoleDefinitionsRequest(isBuiltIn, scope); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(SynapseRoleDefinition.DeserializeSynapseRoleDefinition(item)); - } - value = array; - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// List role definitions. - /// Is a Synapse Built-In Role or not. - /// Scope of the Synapse Built-in Role. - /// The cancellation token to use. - public Response> ListRoleDefinitions(bool? isBuiltIn = null, string scope = null, CancellationToken cancellationToken = default) - { - using var message = CreateListRoleDefinitionsRequest(isBuiltIn, scope); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - IReadOnlyList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(SynapseRoleDefinition.DeserializeSynapseRoleDefinition(item)); - } - value = array; - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetRoleDefinitionByIdRequest(string roleDefinitionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/roleDefinitions/", false); - uri.AppendPath(roleDefinitionId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json, text/json"); - return message; - } - - /// Get role definition by role definition Id. - /// Synapse Built-In Role Definition Id. - /// The cancellation token to use. - /// is null. - public async Task> GetRoleDefinitionByIdAsync(string roleDefinitionId, CancellationToken cancellationToken = default) - { - if (roleDefinitionId == null) - { - throw new ArgumentNullException(nameof(roleDefinitionId)); - } - - using var message = CreateGetRoleDefinitionByIdRequest(roleDefinitionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - SynapseRoleDefinition value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = SynapseRoleDefinition.DeserializeSynapseRoleDefinition(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Get role definition by role definition Id. - /// Synapse Built-In Role Definition Id. - /// The cancellation token to use. - /// is null. - public Response GetRoleDefinitionById(string roleDefinitionId, CancellationToken cancellationToken = default) - { - if (roleDefinitionId == null) - { - throw new ArgumentNullException(nameof(roleDefinitionId)); - } - - using var message = CreateGetRoleDefinitionByIdRequest(roleDefinitionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - SynapseRoleDefinition value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = SynapseRoleDefinition.DeserializeSynapseRoleDefinition(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListScopesRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/rbacScopes", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json, text/json"); - return message; - } - - /// List rbac scopes. - /// The cancellation token to use. - public async Task>> ListScopesAsync(CancellationToken cancellationToken = default) - { - using var message = CreateListScopesRequest(); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(item.GetString()); - } - value = array; - return Response.FromValue(value, message.Response); - } - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// List rbac scopes. - /// The cancellation token to use. - public Response> ListScopes(CancellationToken cancellationToken = default) - { - using var message = CreateListScopesRequest(); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - IReadOnlyList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(item.GetString()); - } - value = array; - return Response.FromValue(value, message.Response); - } - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/SynapseAccessControlClient.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/SynapseAccessControlClient.cs new file mode 100644 index 000000000000..60cd1c70b9a8 --- /dev/null +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/SynapseAccessControlClient.cs @@ -0,0 +1,1099 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Synapse.AccessControl +{ + /// The SynapseAccessControl service client. + public partial class SynapseAccessControlClient + { + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + private readonly string[] AuthorizationScopes = { "https://dev.azuresynapse.net/.default" }; + private readonly TokenCredential _tokenCredential; + private Uri endpoint; + private readonly string apiVersion; + private readonly ClientDiagnostics _clientDiagnostics; + private readonly ResponseClassifier _responseClassifier; + + /// Initializes a new instance of SynapseAccessControlClient for mocking. + protected SynapseAccessControlClient() + { + } + + /// Initializes a new instance of SynapseAccessControlClient. + /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + public SynapseAccessControlClient(Uri endpoint, TokenCredential credential, SynapseAdministrationClientOptions options = null) + { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + if (credential == null) + { + throw new ArgumentNullException(nameof(credential)); + } + + options ??= new SynapseAdministrationClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); + _responseClassifier = new ResponseClassifier(options); + _tokenCredential = credential; + var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); + this.endpoint = endpoint; + apiVersion = options.Version; + } + + /// Check if the given principalId has access to perform list of actions at a given scope. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// subject + /// SubjectInfo + /// Yes + /// Subject details + /// + /// + /// actions + /// RequiredAction[] + /// Yes + /// List of actions. + /// + /// + /// scope + /// string + /// Yes + /// Scope at which the check access is done. + /// + /// + /// Schema for SubjectInfo: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// principalId + /// SubjectInfoPrincipalId + /// Yes + /// Principal Id + /// + /// + /// groupIds + /// SubjectInfoGroupIdsItem[] + /// + /// List of group Ids that the principalId is part of. + /// + /// + /// Schema for RequiredAction: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// id + /// string + /// Yes + /// Action Id. + /// + /// + /// isDataAction + /// boolean + /// Yes + /// Is a data action or not. + /// + /// + /// + /// The content to send as the body of the request. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CheckPrincipalAccessAsync(RequestContent content, RequestOptions options = null) +#pragma warning restore AZC0002 + { + options ??= new RequestOptions(); + HttpMessage message = CreateCheckPrincipalAccessRequest(content, options); + if (options.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", options.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SynapseAccessControlClient.CheckPrincipalAccess"); + scope.Start(); + try + { + await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); + if (options.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _responseClassifier.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Check if the given principalId has access to perform list of actions at a given scope. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// subject + /// SubjectInfo + /// Yes + /// Subject details + /// + /// + /// actions + /// RequiredAction[] + /// Yes + /// List of actions. + /// + /// + /// scope + /// string + /// Yes + /// Scope at which the check access is done. + /// + /// + /// Schema for SubjectInfo: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// principalId + /// SubjectInfoPrincipalId + /// Yes + /// Principal Id + /// + /// + /// groupIds + /// SubjectInfoGroupIdsItem[] + /// + /// List of group Ids that the principalId is part of. + /// + /// + /// Schema for RequiredAction: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// id + /// string + /// Yes + /// Action Id. + /// + /// + /// isDataAction + /// boolean + /// Yes + /// Is a data action or not. + /// + /// + /// + /// The content to send as the body of the request. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CheckPrincipalAccess(RequestContent content, RequestOptions options = null) +#pragma warning restore AZC0002 + { + options ??= new RequestOptions(); + HttpMessage message = CreateCheckPrincipalAccessRequest(content, options); + if (options.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", options.PerCallPolicy); + } + using var scope = _clientDiagnostics.CreateScope("SynapseAccessControlClient.CheckPrincipalAccess"); + scope.Start(); + try + { + Pipeline.Send(message, options.CancellationToken); + if (options.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _responseClassifier.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// The content to send as the body of the request. + /// The request options. + private HttpMessage CreateCheckPrincipalAccessRequest(RequestContent content, RequestOptions options = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/checkAccessSynapseRbac", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json, text/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + /// List role assignments. + /// Synapse Built-In Role Id. + /// Object ID of the AAD principal or security-group. + /// Scope of the Synapse Built-in Role. + /// Continuation token. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListRoleAssignmentsAsync(string roleId = null, string principalId = null, string scope = null, string continuationToken = null, RequestOptions options = null) +#pragma warning restore AZC0002 + { + options ??= new RequestOptions(); + HttpMessage message = CreateListRoleAssignmentsRequest(roleId, principalId, scope, continuationToken, options); + if (options.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", options.PerCallPolicy); + } + using var scope0 = _clientDiagnostics.CreateScope("SynapseAccessControlClient.ListRoleAssignments"); + scope0.Start(); + try + { + await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); + if (options.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _responseClassifier.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// List role assignments. + /// Synapse Built-In Role Id. + /// Object ID of the AAD principal or security-group. + /// Scope of the Synapse Built-in Role. + /// Continuation token. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response ListRoleAssignments(string roleId = null, string principalId = null, string scope = null, string continuationToken = null, RequestOptions options = null) +#pragma warning restore AZC0002 + { + options ??= new RequestOptions(); + HttpMessage message = CreateListRoleAssignmentsRequest(roleId, principalId, scope, continuationToken, options); + if (options.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", options.PerCallPolicy); + } + using var scope0 = _clientDiagnostics.CreateScope("SynapseAccessControlClient.ListRoleAssignments"); + scope0.Start(); + try + { + Pipeline.Send(message, options.CancellationToken); + if (options.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _responseClassifier.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Synapse Built-In Role Id. + /// Object ID of the AAD principal or security-group. + /// Scope of the Synapse Built-in Role. + /// Continuation token. + /// The request options. + private HttpMessage CreateListRoleAssignmentsRequest(string roleId = null, string principalId = null, string scope = null, string continuationToken = null, RequestOptions options = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/roleAssignments", false); + uri.AppendQuery("api-version", apiVersion, true); + if (roleId != null) + { + uri.AppendQuery("roleId", roleId, true); + } + if (principalId != null) + { + uri.AppendQuery("principalId", principalId, true); + } + if (scope != null) + { + uri.AppendQuery("scope", scope, true); + } + request.Uri = uri; + if (continuationToken != null) + { + request.Headers.Add("x-ms-continuation", continuationToken); + } + request.Headers.Add("Accept", "application/json, text/json"); + return message; + } + + /// Create role assignment. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// roleId + /// RoleAssignmentRequestRoleId + /// Yes + /// Role ID of the Synapse Built-In Role + /// + /// + /// principalId + /// RoleAssignmentRequestPrincipalId + /// Yes + /// Object ID of the AAD principal or security-group + /// + /// + /// scope + /// string + /// Yes + /// Scope at which the role assignment is created + /// + /// + /// principalType + /// string + /// + /// Type of the principal Id: User, Group or ServicePrincipal + /// + /// + /// + /// The ID of the role assignment. + /// The content to send as the body of the request. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task CreateRoleAssignmentAsync(string roleAssignmentId, RequestContent content, RequestOptions options = null) +#pragma warning restore AZC0002 + { + options ??= new RequestOptions(); + HttpMessage message = CreateCreateRoleAssignmentRequest(roleAssignmentId, content, options); + if (options.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", options.PerCallPolicy); + } + using var scope0 = _clientDiagnostics.CreateScope("SynapseAccessControlClient.CreateRoleAssignment"); + scope0.Start(); + try + { + await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); + if (options.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _responseClassifier.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Create role assignment. + /// + /// Schema for Request Body: + /// + /// + /// Name + /// Type + /// Required + /// Description + /// + /// + /// roleId + /// RoleAssignmentRequestRoleId + /// Yes + /// Role ID of the Synapse Built-In Role + /// + /// + /// principalId + /// RoleAssignmentRequestPrincipalId + /// Yes + /// Object ID of the AAD principal or security-group + /// + /// + /// scope + /// string + /// Yes + /// Scope at which the role assignment is created + /// + /// + /// principalType + /// string + /// + /// Type of the principal Id: User, Group or ServicePrincipal + /// + /// + /// + /// The ID of the role assignment. + /// The content to send as the body of the request. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response CreateRoleAssignment(string roleAssignmentId, RequestContent content, RequestOptions options = null) +#pragma warning restore AZC0002 + { + options ??= new RequestOptions(); + HttpMessage message = CreateCreateRoleAssignmentRequest(roleAssignmentId, content, options); + if (options.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", options.PerCallPolicy); + } + using var scope0 = _clientDiagnostics.CreateScope("SynapseAccessControlClient.CreateRoleAssignment"); + scope0.Start(); + try + { + Pipeline.Send(message, options.CancellationToken); + if (options.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _responseClassifier.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Create Request for and + /// The ID of the role assignment. + /// The content to send as the body of the request. + /// The request options. + private HttpMessage CreateCreateRoleAssignmentRequest(string roleAssignmentId, RequestContent content, RequestOptions options = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/roleAssignments/", false); + uri.AppendPath(roleAssignmentId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json, text/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + /// Get role assignment by role assignment Id. + /// The ID of the role assignment. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetRoleAssignmentByIdAsync(string roleAssignmentId, RequestOptions options = null) +#pragma warning restore AZC0002 + { + options ??= new RequestOptions(); + HttpMessage message = CreateGetRoleAssignmentByIdRequest(roleAssignmentId, options); + if (options.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", options.PerCallPolicy); + } + using var scope0 = _clientDiagnostics.CreateScope("SynapseAccessControlClient.GetRoleAssignmentById"); + scope0.Start(); + try + { + await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); + if (options.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _responseClassifier.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Get role assignment by role assignment Id. + /// The ID of the role assignment. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response GetRoleAssignmentById(string roleAssignmentId, RequestOptions options = null) +#pragma warning restore AZC0002 + { + options ??= new RequestOptions(); + HttpMessage message = CreateGetRoleAssignmentByIdRequest(roleAssignmentId, options); + if (options.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", options.PerCallPolicy); + } + using var scope0 = _clientDiagnostics.CreateScope("SynapseAccessControlClient.GetRoleAssignmentById"); + scope0.Start(); + try + { + Pipeline.Send(message, options.CancellationToken); + if (options.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _responseClassifier.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// The ID of the role assignment. + /// The request options. + private HttpMessage CreateGetRoleAssignmentByIdRequest(string roleAssignmentId, RequestOptions options = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/roleAssignments/", false); + uri.AppendPath(roleAssignmentId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json, text/json"); + return message; + } + + /// Delete role assignment by role assignment Id. + /// The ID of the role assignment. + /// Scope of the Synapse Built-in Role. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task DeleteRoleAssignmentByIdAsync(string roleAssignmentId, string scope = null, RequestOptions options = null) +#pragma warning restore AZC0002 + { + options ??= new RequestOptions(); + HttpMessage message = CreateDeleteRoleAssignmentByIdRequest(roleAssignmentId, scope, options); + if (options.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", options.PerCallPolicy); + } + using var scope0 = _clientDiagnostics.CreateScope("SynapseAccessControlClient.DeleteRoleAssignmentById"); + scope0.Start(); + try + { + await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); + if (options.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw await _responseClassifier.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Delete role assignment by role assignment Id. + /// The ID of the role assignment. + /// Scope of the Synapse Built-in Role. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response DeleteRoleAssignmentById(string roleAssignmentId, string scope = null, RequestOptions options = null) +#pragma warning restore AZC0002 + { + options ??= new RequestOptions(); + HttpMessage message = CreateDeleteRoleAssignmentByIdRequest(roleAssignmentId, scope, options); + if (options.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", options.PerCallPolicy); + } + using var scope0 = _clientDiagnostics.CreateScope("SynapseAccessControlClient.DeleteRoleAssignmentById"); + scope0.Start(); + try + { + Pipeline.Send(message, options.CancellationToken); + if (options.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw _responseClassifier.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// The ID of the role assignment. + /// Scope of the Synapse Built-in Role. + /// The request options. + private HttpMessage CreateDeleteRoleAssignmentByIdRequest(string roleAssignmentId, string scope = null, RequestOptions options = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/roleAssignments/", false); + uri.AppendPath(roleAssignmentId, true); + uri.AppendQuery("api-version", apiVersion, true); + if (scope != null) + { + uri.AppendQuery("scope", scope, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json, text/json"); + return message; + } + + /// List role definitions. + /// Is a Synapse Built-In Role or not. + /// Scope of the Synapse Built-in Role. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListRoleDefinitionsAsync(bool? isBuiltIn = null, string scope = null, RequestOptions options = null) +#pragma warning restore AZC0002 + { + options ??= new RequestOptions(); + HttpMessage message = CreateListRoleDefinitionsRequest(isBuiltIn, scope, options); + if (options.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", options.PerCallPolicy); + } + using var scope0 = _clientDiagnostics.CreateScope("SynapseAccessControlClient.ListRoleDefinitions"); + scope0.Start(); + try + { + await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); + if (options.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _responseClassifier.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// List role definitions. + /// Is a Synapse Built-In Role or not. + /// Scope of the Synapse Built-in Role. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response ListRoleDefinitions(bool? isBuiltIn = null, string scope = null, RequestOptions options = null) +#pragma warning restore AZC0002 + { + options ??= new RequestOptions(); + HttpMessage message = CreateListRoleDefinitionsRequest(isBuiltIn, scope, options); + if (options.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", options.PerCallPolicy); + } + using var scope0 = _clientDiagnostics.CreateScope("SynapseAccessControlClient.ListRoleDefinitions"); + scope0.Start(); + try + { + Pipeline.Send(message, options.CancellationToken); + if (options.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _responseClassifier.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Is a Synapse Built-In Role or not. + /// Scope of the Synapse Built-in Role. + /// The request options. + private HttpMessage CreateListRoleDefinitionsRequest(bool? isBuiltIn = null, string scope = null, RequestOptions options = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/roleDefinitions", false); + uri.AppendQuery("api-version", apiVersion, true); + if (isBuiltIn != null) + { + uri.AppendQuery("isBuiltIn", isBuiltIn.Value, true); + } + if (scope != null) + { + uri.AppendQuery("scope", scope, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json, text/json"); + return message; + } + + /// Get role definition by role definition Id. + /// Synapse Built-In Role Definition Id. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task GetRoleDefinitionByIdAsync(string roleDefinitionId, RequestOptions options = null) +#pragma warning restore AZC0002 + { + options ??= new RequestOptions(); + HttpMessage message = CreateGetRoleDefinitionByIdRequest(roleDefinitionId, options); + if (options.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", options.PerCallPolicy); + } + using var scope0 = _clientDiagnostics.CreateScope("SynapseAccessControlClient.GetRoleDefinitionById"); + scope0.Start(); + try + { + await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); + if (options.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _responseClassifier.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Get role definition by role definition Id. + /// Synapse Built-In Role Definition Id. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response GetRoleDefinitionById(string roleDefinitionId, RequestOptions options = null) +#pragma warning restore AZC0002 + { + options ??= new RequestOptions(); + HttpMessage message = CreateGetRoleDefinitionByIdRequest(roleDefinitionId, options); + if (options.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", options.PerCallPolicy); + } + using var scope0 = _clientDiagnostics.CreateScope("SynapseAccessControlClient.GetRoleDefinitionById"); + scope0.Start(); + try + { + Pipeline.Send(message, options.CancellationToken); + if (options.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _responseClassifier.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// Synapse Built-In Role Definition Id. + /// The request options. + private HttpMessage CreateGetRoleDefinitionByIdRequest(string roleDefinitionId, RequestOptions options = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/roleDefinitions/", false); + uri.AppendPath(roleDefinitionId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json, text/json"); + return message; + } + + /// List rbac scopes. + /// The request options. +#pragma warning disable AZC0002 + public virtual async Task ListScopesAsync(RequestOptions options = null) +#pragma warning restore AZC0002 + { + options ??= new RequestOptions(); + HttpMessage message = CreateListScopesRequest(options); + if (options.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", options.PerCallPolicy); + } + using var scope0 = _clientDiagnostics.CreateScope("SynapseAccessControlClient.ListScopes"); + scope0.Start(); + try + { + await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); + if (options.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _responseClassifier.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// List rbac scopes. + /// The request options. +#pragma warning disable AZC0002 + public virtual Response ListScopes(RequestOptions options = null) +#pragma warning restore AZC0002 + { + options ??= new RequestOptions(); + HttpMessage message = CreateListScopesRequest(options); + if (options.PerCallPolicy != null) + { + message.SetProperty("RequestOptionsPerCallPolicyCallback", options.PerCallPolicy); + } + using var scope0 = _clientDiagnostics.CreateScope("SynapseAccessControlClient.ListScopes"); + scope0.Start(); + try + { + Pipeline.Send(message, options.CancellationToken); + if (options.StatusOption == ResponseStatusOption.Default) + { + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _responseClassifier.CreateRequestFailedException(message.Response); + } + } + else + { + return message.Response; + } + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// Create Request for and operations. + /// The request options. + private HttpMessage CreateListScopesRequest(RequestOptions options = null) + { + var message = Pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/rbacScopes", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json, text/json"); + return message; + } + } +} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/AccessControlClientOptions.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/SynapseAdministrationClientOptions.cs similarity index 69% rename from sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/AccessControlClientOptions.cs rename to sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/SynapseAdministrationClientOptions.cs index 2128195973e8..09a03f0b9bda 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/AccessControlClientOptions.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/SynapseAdministrationClientOptions.cs @@ -10,8 +10,8 @@ namespace Azure.Analytics.Synapse.AccessControl { - /// Client options for AccessControlClient. - public partial class AccessControlClientOptions : ClientOptions + /// Client options for SynapseAdministrationClient. + public partial class SynapseAdministrationClientOptions : ClientOptions { private const ServiceVersion LatestVersion = ServiceVersion.V2020_12_01; @@ -24,8 +24,8 @@ public enum ServiceVersion internal string Version { get; } - /// Initializes new instance of AccessControlClientOptions. - public AccessControlClientOptions(ServiceVersion version = LatestVersion) + /// Initializes new instance of SynapseAdministrationClientOptions. + public SynapseAdministrationClientOptions(ServiceVersion version = LatestVersion) { Version = version switch { diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Models/SynapsePermission.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Models/SynapsePermission.cs new file mode 100644 index 000000000000..6c03234a6fda --- /dev/null +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Models/SynapsePermission.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Synapse.AccessControl +{ + public class SynapsePermission + { + public SynapsePermission(IList actions, IList notActions, IList dataActions, IList notDataActions) + { + Actions = actions; + NotActions = notActions; + DataActions = dataActions; + NotDataActions = notDataActions; + } + + public IList Actions { get; } + + public IList NotActions { get; } + + // TODO: In order to align with ARM/KeyVault RBAC APIs, change the below type from 'string' to 'SynapseDataAction', populate the list of actions + public IList DataActions { get; } + + public IList NotDataActions { get; } + + public static implicit operator RequestContent(SynapsePermission permission) => RequestContent.Create( + new + { + permission.Actions, + permission.NotActions, + permission.DataActions, + permission.NotDataActions + }); + } +} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Models/SynapsePrincipalType.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Models/SynapsePrincipalType.cs new file mode 100644 index 000000000000..3baf78846e6e --- /dev/null +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Models/SynapsePrincipalType.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.ComponentModel; +using Azure.Core; + +namespace Azure.Analytics.Synapse.AccessControl +{ + // TODO: Populate this list of scopes + + public readonly partial struct SynapsePrincipalType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public SynapsePrincipalType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UserValue = "User"; + private const string GroupValue = "Group"; + private const string ServicePrincipalValue = "ServicePrincipal"; + + /// Global scope. + public static SynapsePrincipalType User { get; } = new SynapsePrincipalType(UserValue); + public static SynapsePrincipalType Group { get; } = new SynapsePrincipalType(GroupValue); + public static SynapsePrincipalType ServicePrincipal { get; } = new SynapsePrincipalType(ServicePrincipalValue); + + /// Determines if two values are the same. + public static bool operator ==(SynapsePrincipalType left, SynapsePrincipalType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SynapsePrincipalType left, SynapsePrincipalType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SynapsePrincipalType(string value) => new SynapsePrincipalType(value); + /// Converts a to a . + public static implicit operator RequestContent(SynapsePrincipalType scope) => RequestContent.Create(scope._value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SynapseRoleScope other && Equals(other); + /// + public bool Equals(SynapsePrincipalType 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/synapse/Azure.Analytics.Synapse.AccessControl/src/Models/SynapseRoleAssignment.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Models/SynapseRoleAssignment.cs new file mode 100644 index 000000000000..155eed6ec845 --- /dev/null +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Models/SynapseRoleAssignment.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.Core; + +namespace Azure.Analytics.Synapse.AccessControl +{ + public class SynapseRoleAssignment + { + public SynapseRoleAssignment(Guid roleId, Guid principalId, string scope, SynapsePrincipalType? principalType = null) + { + Id = roleId; + Properties = new SynapseRoleAssignmentProperties( + principalId, + scope, + principalType); + + // TODO: Why aren't name and type available? (Where they are available in ARM + KV APIs) + //Name = name; + //Type = type; + } + + internal SynapseRoleAssignment(Guid roleId, Guid principalId, Guid roleDefinitionId, string scope, SynapsePrincipalType? principalType = null) + { + Id = roleId; + Properties = new SynapseRoleAssignmentProperties( + principalId, + roleDefinitionId, + scope, + principalType); + } + + public Guid Id { get; } + + public SynapseRoleAssignmentProperties Properties { get; } + + public static implicit operator RequestContent(SynapseRoleAssignment value) => RequestContent.Create( + new + { + Id = value.Id, + Properties = value.Properties + }); + + public static implicit operator SynapseRoleAssignment(Response response) + { + if (!response.IsError()) + { + return DeserializeResponse(response); + } + else + { + response.Throw(); // What to do about Async here? Can you put awaits in operators? + } + + // we should never get here, since we throw in the else statement above. +#pragma warning disable CA1065 // Do not raise exceptions in unexpected locations + throw new NotSupportedException(); +#pragma warning restore CA1065 // Do not raise exceptions in unexpected locations + } + + private static SynapseRoleAssignment DeserializeResponse(Response response) + { + throw new NotImplementedException(); + } + } +} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Models/SynapseRoleAssignmentProperties.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Models/SynapseRoleAssignmentProperties.cs new file mode 100644 index 000000000000..ffd14ec02557 --- /dev/null +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Models/SynapseRoleAssignmentProperties.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.Core; + +namespace Azure.Analytics.Synapse.AccessControl +{ + public class SynapseRoleAssignmentProperties + { + public SynapseRoleAssignmentProperties(Guid principalId, SynapseRoleScope? scope = default, SynapsePrincipalType? principalType = default) + { + PrincipalId = principalId; + Scope = scope; + PrincipalType = principalType; + } + + internal SynapseRoleAssignmentProperties(Guid principalId, Guid roleDefinitionId, SynapseRoleScope? scope = default, SynapsePrincipalType? principalType = default) + { + PrincipalId = principalId; + RoleDefinitionId = roleDefinitionId; + Scope = scope; + PrincipalType = principalType; + } + + public Guid PrincipalId { get; } + public Guid RoleDefinitionId { get; } + public SynapseRoleScope? Scope { get; } + public SynapsePrincipalType? PrincipalType { get; } + } +} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Models/SynapseRoleDefinition.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Models/SynapseRoleDefinition.cs new file mode 100644 index 000000000000..e65e245ac07f --- /dev/null +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Models/SynapseRoleDefinition.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Synapse.AccessControl +{ + public class SynapseRoleDefinition + { + public SynapseRoleDefinition(string id, string name,string description, IList permissions, IList assignableScopes) + { + Id = id; + Name = name; + Description = description; + Permissions = permissions; + AssignableScopes = assignableScopes; + } + + public string Id { get; } + + public string Name { get; } + + public string Description { get; set; } + + public IList Permissions { get; } + + public IList AssignableScopes { get; } + + public static implicit operator RequestContent(SynapseRoleDefinition value) => RequestContent.Create( + new { + Id = value.Id, + Name = value.Name, + Description = value.Description, + Permissions = value.Permissions, + AssignableScopes = value.AssignableScopes + }); + + // TODO: solve the missing properties, in order to bring this type into alignment with ARM and KeyVault RBAC APIs + //public SynapseRoleDefinitionType? Type { get; } + + //public string RoleName { get; set; } + + //public SynapseRoleType? RoleType { get; set; } + } +} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Models/SynapseRoleScope.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Models/SynapseRoleScope.cs new file mode 100644 index 000000000000..8421016c4e03 --- /dev/null +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Models/SynapseRoleScope.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.ComponentModel; +using Azure.Core; + +namespace Azure.Analytics.Synapse.AccessControl +{ + // TODO: Populate this list of scopes + + public readonly partial struct SynapseRoleScope : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public SynapseRoleScope(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string GlobalValue = "/"; + + /// Global scope. + public static SynapseRoleScope Global { get; } = new SynapseRoleScope(GlobalValue); + /// Determines if two values are the same. + public static bool operator ==(SynapseRoleScope left, SynapseRoleScope right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SynapseRoleScope left, SynapseRoleScope right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SynapseRoleScope(string value) => new SynapseRoleScope(value); + /// Converts a to a . + public static implicit operator RequestContent(SynapseRoleScope scope) => RequestContent.Create(scope._value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SynapseRoleScope other && Equals(other); + /// + public bool Equals(SynapseRoleScope 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/synapse/Azure.Analytics.Synapse.AccessControl/src/SynapseAccessControlClient.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/SynapseAccessControlClient.cs new file mode 100644 index 000000000000..f40585942fc1 --- /dev/null +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/SynapseAccessControlClient.cs @@ -0,0 +1,556 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Synapse.AccessControl +{ + public partial class SynapseAccessControlClient + { +#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + public virtual Response CreateRoleAssignment(SynapseRoleScope roleScope, string roleDefinitionId, string principalId, Guid? roleAssignmentName = null) +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + { + Argument.AssertNotNullOrEmpty(roleDefinitionId, nameof(roleDefinitionId)); + Argument.AssertNotNullOrEmpty(principalId, nameof(principalId)); + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SynapseAccessControlClient)}.{nameof(CreateRoleAssignment)}"); + scope.Start(); + try + { + string name = (roleAssignmentName ?? Guid.NewGuid()).ToString(); + + Response createRoleAssignmentResponse = CreateRoleAssignment( + name, + RequestContent.Create( + new + { + RoleId = roleDefinitionId, + PrincipalId = principalId, + Scope = roleScope.ToString() + })); + + JsonDocument roleAssignment = JsonDocument.Parse(createRoleAssignmentResponse.Content.ToMemory()); + + return Response.FromValue(new SynapseRoleAssignment( + new Guid(roleAssignment.RootElement.GetProperty("id").ToString()), + new Guid(roleAssignment.RootElement.GetProperty("principalId").ToString()), + new Guid(roleAssignment.RootElement.GetProperty("roleDefinitionId").ToString()), + roleAssignment.RootElement.GetProperty("scope").ToString(), + roleAssignment.RootElement.GetProperty("principalType").ToString()), + createRoleAssignmentResponse); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + +#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + public virtual async Task> CreateRoleAssignmentAsync(SynapseRoleScope roleScope, string roleDefinitionId, string principalId, Guid? roleAssignmentName = null) +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + { + Argument.AssertNotNullOrEmpty(roleDefinitionId, nameof(roleDefinitionId)); + Argument.AssertNotNullOrEmpty(principalId, nameof(principalId)); + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SynapseAccessControlClient)}.{nameof(CreateRoleAssignment)}"); + scope.Start(); + try + { + string name = (roleAssignmentName ?? Guid.NewGuid()).ToString(); + + Response createRoleAssignmentResponse = await CreateRoleAssignmentAsync( + name, + RequestContent.Create( + new + { + RoleId = roleDefinitionId, + PrincipalId = principalId, + Scope = roleScope.ToString() + })).ConfigureAwait(false); + + JsonDocument roleAssignment = await JsonDocument.ParseAsync(createRoleAssignmentResponse.ContentStream, default).ConfigureAwait(false); + + return Response.FromValue(new SynapseRoleAssignment( + new Guid(roleAssignment.RootElement.GetProperty("id").ToString()), + new Guid(roleAssignment.RootElement.GetProperty("principalId").ToString()), + new Guid(roleAssignment.RootElement.GetProperty("roleDefinitionId").ToString()), + roleAssignment.RootElement.GetProperty("scope").ToString(), + roleAssignment.RootElement.GetProperty("principalType").ToString()), + createRoleAssignmentResponse); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + +#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + public virtual Response CreateRoleAssignment(string roleAssignmentId, SynapseRoleAssignment roleAssignment) +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + { + Argument.AssertNotNullOrEmpty(roleAssignmentId, nameof(roleAssignmentId)); + Argument.AssertNotNull(roleAssignment, nameof(roleAssignment)); + Argument.AssertNotNull(roleAssignment.Properties.Scope, nameof(roleAssignment.Properties.Scope)); + + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SynapseAccessControlClient)}.{nameof(CreateRoleAssignment)}"); + scope.Start(); + try + { + Response createRoleAssignmentResponse = CreateRoleAssignment( + roleAssignmentId, + RequestContent.Create( + new + { + RoleId = roleAssignment.Properties.RoleDefinitionId, + PrincipalId = roleAssignment.Properties.PrincipalId, + Scope = roleAssignment.Properties.Scope.ToString() + })); + + JsonDocument responseJson = JsonDocument.Parse(createRoleAssignmentResponse.Content.ToMemory()); + + return Response.FromValue(new SynapseRoleAssignment( + new Guid(responseJson.RootElement.GetProperty("id").ToString()), + new Guid(responseJson.RootElement.GetProperty("principalId").ToString()), + new Guid(responseJson.RootElement.GetProperty("roleDefinitionId").ToString()), + responseJson.RootElement.GetProperty("scope").ToString(), + responseJson.RootElement.GetProperty("principalType").ToString()), + createRoleAssignmentResponse); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + +#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + public virtual Response DeleteRoleAssignment(SynapseRoleScope roleScope, string roleAssignmentName) +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + { + Argument.AssertNotNullOrEmpty(roleAssignmentName, nameof(roleAssignmentName)); + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SynapseAccessControlClient)}.{nameof(DeleteRoleAssignment)}"); + scope.Start(); + try + { + return DeleteRoleAssignmentById( + roleAssignmentName, + roleScope.ToString()); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + +#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + public virtual async Task DeleteRoleAssignmentAsync(SynapseRoleScope roleScope, string roleAssignmentName) +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + { + Argument.AssertNotNullOrEmpty(roleAssignmentName, nameof(roleAssignmentName)); + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SynapseAccessControlClient)}.{nameof(DeleteRoleAssignment)}"); + scope.Start(); + try + { + return await DeleteRoleAssignmentByIdAsync( + roleAssignmentName, + roleScope.ToString()).ConfigureAwait(false); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + // TODO: do not use roleScope ? + // GetRoleAssignmentById(string roleAssignmentId, RequestOptions options = null) +#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + public virtual Response GetRoleAssignment(SynapseRoleScope roleScope, string roleAssignmentName) +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + { + Argument.AssertNotNullOrEmpty(roleAssignmentName, nameof(roleAssignmentName)); + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SynapseAccessControlClient)}.{nameof(GetRoleAssignment)}"); + scope.Start(); + try + { + Response roleAssignmentResponse = GetRoleAssignmentById(roleAssignmentName); + + JsonDocument roleAssignment = JsonDocument.Parse(roleAssignmentResponse.Content.ToMemory()); + + return Response.FromValue(new SynapseRoleAssignment( + new Guid(roleAssignment.RootElement.GetProperty("id").ToString()), + new Guid(roleAssignment.RootElement.GetProperty("principalId").ToString()), + new Guid(roleAssignment.RootElement.GetProperty("roleDefinitionId").ToString()), + roleAssignment.RootElement.GetProperty("scope").ToString(), + roleAssignment.RootElement.GetProperty("principalType").ToString()), + roleAssignmentResponse); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + +#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + public virtual async Task> GetRoleAssignmentAsync(SynapseRoleScope roleScope, string roleAssignmentName) +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + { + Argument.AssertNotNullOrEmpty(roleAssignmentName, nameof(roleAssignmentName)); + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SynapseAccessControlClient)}.{nameof(GetRoleAssignment)}"); + scope.Start(); + try + { + Response roleAssignmentResponse = await GetRoleAssignmentByIdAsync(roleAssignmentName).ConfigureAwait(false); + + JsonDocument roleAssignment = await JsonDocument.ParseAsync(roleAssignmentResponse.ContentStream, default).ConfigureAwait(false); + + return Response.FromValue(new SynapseRoleAssignment( + new Guid(roleAssignment.RootElement.GetProperty("id").ToString()), + new Guid(roleAssignment.RootElement.GetProperty("principalId").ToString()), + new Guid(roleAssignment.RootElement.GetProperty("roleDefinitionId").ToString()), + roleAssignment.RootElement.GetProperty("scope").ToString(), + roleAssignment.RootElement.GetProperty("principalType").ToString()), + roleAssignmentResponse); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + // TODO: change return type from list to pageable + // TODO: get by roleId or get by principalId ? + // ListRoleAssignments(string roleId = null, string principalId = null, string scope = null, string continuationToken = null, RequestOptions options = null) +#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + public virtual Pageable GetRoleAssignments(SynapseRoleScope? roleScope = null) +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + { + return PageableHelpers.CreateEnumerable(_ => + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SynapseAccessControlClient)}.{nameof(GetRoleAssignments)}"); + scope.Start(); + try + { + var response = ListRoleAssignments(scope: roleScope.ToString()); + + JsonDocument roleAssignmentListJson = JsonDocument.Parse(response.Content.ToMemory()); + List roleAssignmentList = new List(); + foreach (var roleAssignment in roleAssignmentListJson.RootElement.GetProperty("value").EnumerateArray()) + { + roleAssignmentList.Add(new SynapseRoleAssignment( + new Guid(roleAssignment.GetProperty("id").ToString()), + new Guid(roleAssignment.GetProperty("principalId").ToString()), + new Guid(roleAssignment.GetProperty("roleDefinitionId").ToString()), + roleAssignment.GetProperty("scope").ToString(), + roleAssignment.GetProperty("principalType").ToString())); + } + + return Page.FromValues(roleAssignmentList, null, response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + }, (null)); + } + +#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + public virtual AsyncPageable GetRoleAssignmentsAsync(SynapseRoleScope? roleScope = null) +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + { + return PageableHelpers.CreateAsyncEnumerable(async _ => + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SynapseAccessControlClient)}.{nameof(ListRoleAssignments)}"); + scope.Start(); + try + { + var response = await ListRoleAssignmentsAsync(scope: roleScope.ToString()).ConfigureAwait(false); + + JsonDocument roleAssignmentListJson = await JsonDocument.ParseAsync(response.ContentStream, default).ConfigureAwait(false); + List roleAssignmentList = new List(); + foreach (var roleAssignment in roleAssignmentListJson.RootElement.GetProperty("value").EnumerateArray()) + { + roleAssignmentList.Add(new SynapseRoleAssignment( + new Guid(roleAssignment.GetProperty("id").ToString()), + new Guid(roleAssignment.GetProperty("principalId").ToString()), + new Guid(roleAssignment.GetProperty("roleDefinitionId").ToString()), + roleAssignment.GetProperty("scope").ToString(), + roleAssignment.GetProperty("principalType").ToString())); + } + + return Page.FromValues(roleAssignmentList, null, response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + }, (null)); + } + + // TODO: do not use roleScope ? + // GetRoleDefinitionById(string roleDefinitionId, RequestOptions options = null) +#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + public virtual Response GetRoleDefinition(SynapseRoleScope roleScope, Guid roleDefinitionName) +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SynapseAccessControlClient)}.{nameof(GetRoleDefinition)}"); + scope.Start(); + try + { + var response = GetRoleDefinitionById(roleDefinitionName.ToString()); + + JsonDocument roleDefinitionJson = JsonDocument.Parse(response.Content.ToMemory()); + List permissions = new List(); + foreach (var permissionsItem in roleDefinitionJson.RootElement.GetProperty("permissions").EnumerateArray()) + { + List actions = new List(); + List notActions = new List(); + List dataActions = new List(); + List notDataActions = new List(); + foreach (var actionsItem in permissionsItem.GetProperty("actions").EnumerateArray()) + { + actions.Add(actionsItem.GetString()); + } + foreach (var notActionsItem in permissionsItem.GetProperty("notActions").EnumerateArray()) + { + notActions.Add(notActionsItem.GetString()); + } + foreach (var dataActionsItem in permissionsItem.GetProperty("dataActions").EnumerateArray()) + { + dataActions.Add(dataActionsItem.GetString()); + } + foreach (var notDataActionsItem in permissionsItem.GetProperty("notDataActions").EnumerateArray()) + { + notDataActions.Add(notDataActionsItem.GetString()); + } + permissions.Add(new SynapsePermission(actions, notActions, dataActions, notDataActions)); + } + List scopes = new List(); + foreach (var scopesItem in roleDefinitionJson.RootElement.GetProperty("scopes").EnumerateArray()) + { + scopes.Add(scopesItem.GetString()); + } + + return Response.FromValue(new SynapseRoleDefinition( + roleDefinitionJson.RootElement.GetProperty("id").ToString(), + roleDefinitionJson.RootElement.GetProperty("name").ToString(), + roleDefinitionJson.RootElement.GetProperty("description").ToString(), + permissions, + scopes), + response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + +#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + public virtual async Task> GetRoleDefinitionAsync(SynapseRoleScope roleScope, Guid roleDefinitionName) +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SynapseAccessControlClient)}.{nameof(GetRoleDefinition)}"); + scope.Start(); + try + { + var response = await GetRoleDefinitionByIdAsync(roleDefinitionName.ToString()).ConfigureAwait(false); + + JsonDocument roleDefinitionJson = await JsonDocument.ParseAsync(response.ContentStream, default).ConfigureAwait(false); + List permissions = new List(); + foreach (var permissionsItem in roleDefinitionJson.RootElement.GetProperty("permissions").EnumerateArray()) + { + List actions = new List(); + List notActions = new List(); + List dataActions = new List(); + List notDataActions = new List(); + foreach (var actionsItem in permissionsItem.GetProperty("actions").EnumerateArray()) + { + actions.Add(actionsItem.GetString()); + } + foreach (var notActionsItem in permissionsItem.GetProperty("notActions").EnumerateArray()) + { + notActions.Add(notActionsItem.GetString()); + } + foreach (var dataActionsItem in permissionsItem.GetProperty("dataActions").EnumerateArray()) + { + dataActions.Add(dataActionsItem.GetString()); + } + foreach (var notDataActionsItem in permissionsItem.GetProperty("notDataActions").EnumerateArray()) + { + notDataActions.Add(notDataActionsItem.GetString()); + } + permissions.Add(new SynapsePermission(actions, notActions, dataActions, notDataActions)); + } + List scopes = new List(); + foreach (var scopesItem in roleDefinitionJson.RootElement.GetProperty("scopes").EnumerateArray()) + { + scopes.Add(scopesItem.GetString()); + } + + return Response.FromValue(new SynapseRoleDefinition( + roleDefinitionJson.RootElement.GetProperty("id").ToString(), + roleDefinitionJson.RootElement.GetProperty("name").ToString(), + roleDefinitionJson.RootElement.GetProperty("description").ToString(), + permissions, + scopes), + response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + // TODO: change return type from list to pageable +#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + public virtual Pageable GetRoleDefinitions(SynapseRoleScope roleScope) +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + { + return PageableHelpers.CreateEnumerable(_ => + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SynapseAccessControlClient)}.{nameof(GetRoleDefinitions)}"); + scope.Start(); + try + { + var response = ListRoleDefinitions(scope: roleScope.ToString()); + + JsonDocument roleDefinitionListJson = JsonDocument.Parse(response.Content.ToMemory()); + List roleDefinitionList = new List(); + foreach (var item in roleDefinitionListJson.RootElement.EnumerateArray()) + { + List permissions = new List(); + foreach (var permissionsItem in item.GetProperty("permissions").EnumerateArray()) + { + List actions = new List(); + List notActions = new List(); + List dataActions = new List(); + List notDataActions = new List(); + foreach (var actionsItem in permissionsItem.GetProperty("actions").EnumerateArray()) + { + actions.Add(actionsItem.GetString()); + } + foreach (var notActionsItem in permissionsItem.GetProperty("notActions").EnumerateArray()) + { + notActions.Add(notActionsItem.GetString()); + } + foreach (var dataActionsItem in permissionsItem.GetProperty("dataActions").EnumerateArray()) + { + dataActions.Add(dataActionsItem.GetString()); + } + foreach (var notDataActionsItem in permissionsItem.GetProperty("notDataActions").EnumerateArray()) + { + notDataActions.Add(notDataActionsItem.GetString()); + } + permissions.Add(new SynapsePermission(actions, notActions, dataActions, notDataActions)); + } + List scopes = new List(); + foreach (var scopesItem in item.GetProperty("scopes").EnumerateArray()) + { + scopes.Add(scopesItem.GetString()); + } + roleDefinitionList.Add(new SynapseRoleDefinition( + item.GetProperty("id").ToString(), + item.GetProperty("name").ToString(), + item.GetProperty("description").ToString(), + permissions, + scopes + )); + } + + return Page.FromValues(roleDefinitionList, null, response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + }, (null)); + } + +#pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + public virtual AsyncPageable GetRoleDefinitionsAsync(SynapseRoleScope roleScope) +#pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. + { + return PageableHelpers.CreateAsyncEnumerable(async _ => + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SynapseAccessControlClient)}.{nameof(GetRoleDefinitions)}"); + scope.Start(); + try + { + var response = await ListRoleDefinitionsAsync(scope: roleScope.ToString()).ConfigureAwait(false); + + JsonDocument roleDefinitionListJson = await JsonDocument.ParseAsync(response.ContentStream, default).ConfigureAwait(false); + List roleDefinitionList = new List(); + foreach (var item in roleDefinitionListJson.RootElement.EnumerateArray()) + { + List permissions = new List(); + foreach (var permissionsItem in item.GetProperty("permissions").EnumerateArray()) + { + List actions = new List(); + List notActions = new List(); + List dataActions = new List(); + List notDataActions = new List(); + foreach (var actionsItem in permissionsItem.GetProperty("actions").EnumerateArray()) + { + actions.Add(actionsItem.GetString()); + } + foreach (var notActionsItem in permissionsItem.GetProperty("notActions").EnumerateArray()) + { + notActions.Add(notActionsItem.GetString()); + } + foreach (var dataActionsItem in permissionsItem.GetProperty("dataActions").EnumerateArray()) + { + dataActions.Add(dataActionsItem.GetString()); + } + foreach (var notDataActionsItem in permissionsItem.GetProperty("notDataActions").EnumerateArray()) + { + notDataActions.Add(notDataActionsItem.GetString()); + } + permissions.Add(new SynapsePermission(actions, notActions, dataActions, notDataActions)); + } + List scopes = new List(); + foreach (var scopesItem in item.GetProperty("scopes").EnumerateArray()) + { + scopes.Add(scopesItem.GetString()); + } + roleDefinitionList.Add(new SynapseRoleDefinition( + item.GetProperty("id").ToString(), + item.GetProperty("name").ToString(), + item.GetProperty("description").ToString(), + permissions, + scopes + )); + } + + return Page.FromValues(roleDefinitionList, null, response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + }, (null)); + } + + // TODO: don't have related APIs in Synaspe + //public virtual Response CreateOrUpdateRoleDefinition(KeyVaultRoleScope roleScope, Guid? roleDefinitionName = null, CancellationToken cancellationToken = default); + //public virtual Response CreateOrUpdateRoleDefinition(CreateOrUpdateRoleDefinitionOptions options, CancellationToken cancellationToken = default); + //public virtual Task> CreateOrUpdateRoleDefinitionAsync(KeyVaultRoleScope roleScope, Guid? roleDefinitionName = null, CancellationToken cancellationToken = default); + //public virtual Task> CreateOrUpdateRoleDefinitionAsync(CreateOrUpdateRoleDefinitionOptions options, CancellationToken cancellationToken = default); + //public virtual Response DeleteRoleDefinition(KeyVaultRoleScope roleScope, Guid roleDefinitionName, CancellationToken cancellationToken = default); + //public virtual Task DeleteRoleDefinitionAsync(KeyVaultRoleScope roleScope, Guid roleDefinitionName, CancellationToken cancellationToken = default); + } +} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/autorest.md b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/autorest.md index f3a94163d2c5..02ffdbe2bbe0 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/autorest.md +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/autorest.md @@ -6,11 +6,15 @@ Run `dotnet build /t:GenerateCode` to generate code. > see https://aka.ms/autorest ``` yaml -tag: package-access-control-2020-12-01 -require: - - https://github.com/Azure/azure-rest-api-specs/blob/37c4ff1612668f5acec62dea729ca3a66b591d7f/specification/synapse/data-plane/readme.md -namespace: Azure.Analytics.Synapse.AccessControl +# tag: package-access-control-2020-12-01 +input-file: +# - https://github.com/Azure/azure-rest-api-specs/blob/37c4ff1612668f5acec62dea729ca3a66b591d7f/specification/synapse/data-plane/readme.md + - $(this-folder)/swagger/checkAccessSynapseRbac.json + - $(this-folder)/swagger/roleAssignments.json + - $(this-folder)/swagger/roleDefinitions.json +namespace: Azure.Analytics.Synapse.Administration public-clients: true +low-level-client: true security: AADToken security-scopes: https://dev.azuresynapse.net/.default ``` diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/swagger/checkAccessSynapseRbac.json b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/swagger/checkAccessSynapseRbac.json new file mode 100644 index 000000000000..e95484aa782c --- /dev/null +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/swagger/checkAccessSynapseRbac.json @@ -0,0 +1,217 @@ +{ + "swagger": "2.0", + "info": { + "version": "2020-12-01", + "title": "SynapseAdministrationClient" + }, + "x-ms-parameterized-host": { + "hostTemplate": "{endpoint}", + "useSchemePrefix": false, + "parameters": [ + { + "$ref": "#/parameters/Endpoint" + } + ] + }, + "schemes": [ + "https" + ], + "paths": { + "/checkAccessSynapseRbac": { + "post": { + "tags": [ + "CheckPrincipalAccess" + ], + "operationId": "SynapseAccessControl_CheckPrincipalAccess", + "description": "Check if the given principalId has access to perform list of actions at a given scope.", + "x-ms-examples": { + "Check access": { + "$ref": "./examples/CheckAccessSynapseRbac.json" + } + }, + "consumes": [ + "application/json", + "text/json" + ], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "request", + "in": "body", + "required": true, + "x-ms-client-flatten": true, + "description": "Details of scope, list of actions and principal.", + "schema": { + "$ref": "#/definitions/CheckPrincipalAccessRequest" + } + }, + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success response.", + "schema": { + "$ref": "#/definitions/CheckPrincipalAccessResponse" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "common/v1/types.json#/definitions/ErrorContract" + } + } + } + } + } + }, + "definitions": { + "CheckPrincipalAccessRequest": { + "description": "Check access request details", + "type": "object", + "required": [ + "scope", + "actions", + "subject" + ], + "properties": { + "subject": { + "description": "Subject details", + "type": "object", + "$ref": "#/definitions/SubjectInfo" + }, + "actions": { + "description": "List of actions.", + "type": "array", + "items": { + "$ref": "#/definitions/RequiredAction" + } + }, + "scope": { + "description": "Scope at which the check access is done.", + "type": "string" + } + } + }, + "RequiredAction": { + "description": "Action Info", + "type": "object", + "required": [ + "id", + "isDataAction" + ], + "properties": { + "id": { + "description": "Action Id.", + "type": "string" + }, + "isDataAction": { + "description": "Is a data action or not.", + "type": "boolean" + } + } + }, + "CheckPrincipalAccessResponse": { + "description": "Check access response details", + "type": "object", + "properties": { + "accessDecisions": { + "description": "To check if the current user, group, or service principal has permission to read artifacts in the specified workspace.", + "type": "array", + "items": { + "$ref": "#/definitions/CheckAccessDecision" + } + } + } + }, + "SubjectInfo": { + "description": "Subject details", + "type": "object", + "required": [ + "principalId" + ], + "properties": { + "principalId": { + "description": "Principal Id", + "format": "uuid", + "type": "string" + }, + "groupIds": { + "description": "List of group Ids that the principalId is part of.", + "type": "array", + "items": { + "format": "uuid", + "type": "string" + } + } + } + }, + "CheckAccessDecision": { + "description": "Check access response details", + "type": "object", + "properties": { + "accessDecision": { + "description": "Access Decision.", + "type": "string" + }, + "actionId": { + "description": "Action Id.", + "type": "string" + }, + "roleAssignment": { + "$ref": "#/definitions/RoleAssignmentDetails" + } + } + }, + "RoleAssignmentDetails": { + "description": "Role Assignment response details", + "type": "object", + "properties": { + "id": { + "description": "Role Assignment ID", + "type": "string" + }, + "roleDefinitionId": { + "description": "Role ID of the Synapse Built-In Role", + "format": "uuid", + "type": "string" + }, + "principalId": { + "description": "Object ID of the AAD principal or security-group", + "format": "uuid", + "type": "string" + }, + "scope": { + "description": "Scope at the role assignment is created", + "type": "string" + }, + "principalType": { + "description": "Type of the principal Id: User, Group or ServicePrincipal", + "type": "string" + } + } + } + }, + "parameters": { + "Endpoint": { + "name": "endpoint", + "description": "The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net.", + "required": true, + "type": "string", + "in": "path", + "x-ms-skip-url-encoding": true, + "x-ms-parameter-location": "client" + }, + "ApiVersionParameter": { + "name": "api-version", + "in": "query", + "required": true, + "type": "string", + "description": "The Synapse client API Version." + } + } +} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/swagger/common/v1/arm-common-types.json b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/swagger/common/v1/arm-common-types.json new file mode 100644 index 000000000000..a6255bbf1aaf --- /dev/null +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/swagger/common/v1/arm-common-types.json @@ -0,0 +1,570 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0", + "title": "Common types" + }, + "paths": {}, + "definitions": { + "Resource": { + "title": "Resource", + "description": "Common fields that are returned in the response for all Azure Resource Manager resources", + "type": "object", + "properties": { + "id": { + "readOnly": true, + "type": "string", + "description": "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + }, + "name": { + "readOnly": true, + "type": "string", + "description": "The name of the resource" + }, + "type": { + "readOnly": true, + "type": "string", + "description": "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\"" + } + }, + "x-ms-azure-resource": true + }, + "AzureEntityResource": { + "x-ms-client-name": "AzureEntityResource", + "title": "Entity Resource", + "description": "The resource model definition for an Azure Resource Manager resource with an etag.", + "type": "object", + "properties": { + "etag": { + "type": "string", + "readOnly": true, + "description": "Resource Etag." + } + }, + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ] + }, + "TrackedResource": { + "title": "Tracked Resource", + "description": "The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'", + "type": "object", + "properties": { + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "x-ms-mutability": [ + "read", + "create", + "update" + ], + "description": "Resource tags." + }, + "location": { + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ], + "description": "The geo-location where the resource lives" + } + }, + "required": [ + "location" + ], + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ] + }, + "ProxyResource": { + "title": "Proxy Resource", + "description": "The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Resource" + } + ] + }, + "ResourceModelWithAllowedPropertySet": { + "description": "The resource model definition containing the full set of allowed properties for a resource. Except properties bag, there cannot be a top level property outside of this set.", + "type": "object", + "properties": { + "id": { + "readOnly": true, + "type": "string", + "x-ms-mutability": [ + "read" + ], + "description": "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + }, + "name": { + "readOnly": true, + "type": "string", + "description": "The name of the resource" + }, + "type": { + "readOnly": true, + "type": "string", + "x-ms-mutability": [ + "read" + ], + "description": "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\"" + }, + "location": { + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ], + "description": "The geo-location where the resource lives" + }, + "managedBy": { + "type": "string", + "x-ms-mutability": [ + "read", + "create", + "update" + ], + "description": "The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource." + }, + "kind": { + "type": "string", + "x-ms-mutability": [ + "read", + "create" + ], + "description": "Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value.", + "pattern": "^[-\\w\\._,\\(\\)]+$" + }, + "etag": { + "readOnly": true, + "type": "string", + "description": "The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. " + }, + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "x-ms-mutability": [ + "read", + "create", + "update" + ], + "description": "Resource tags." + }, + "identity": { + "allOf": [ + { + "$ref": "#/definitions/Identity" + } + ] + }, + "sku": { + "allOf": [ + { + "$ref": "#/definitions/Sku" + } + ] + }, + "plan": { + "allOf": [ + { + "$ref": "#/definitions/Plan" + } + ] + } + }, + "x-ms-azure-resource": true + }, + "Sku": { + "description": "The resource model definition representing SKU", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the SKU. Ex - P3. It is typically a letter+number code" + }, + "tier": { + "type": "string", + "enum": [ + "Free", + "Basic", + "Standard", + "Premium" + ], + "x-ms-enum": { + "name": "SkuTier", + "modelAsString": false + }, + "description": "This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT." + }, + "size": { + "type": "string", + "description": "The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. " + }, + "family": { + "type": "string", + "description": "If the service has different generations of hardware, for the same SKU, then that can be captured here." + }, + "capacity": { + "type": "integer", + "format": "int32", + "description": "If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted." + } + }, + "required": [ + "name" + ] + }, + "Identity": { + "description": "Identity for the resource.", + "type": "object", + "properties": { + "principalId": { + "readOnly": true, + "type": "string", + "description": "The principal ID of resource identity." + }, + "tenantId": { + "readOnly": true, + "type": "string", + "description": "The tenant ID of resource." + }, + "type": { + "type": "string", + "description": "The identity type.", + "enum": [ + "SystemAssigned" + ], + "x-ms-enum": { + "name": "ResourceIdentityType", + "modelAsString": false + } + } + } + }, + "Plan": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "A user defined name of the 3rd Party Artifact that is being procured." + }, + "publisher": { + "type": "string", + "description": "The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic" + }, + "product": { + "type": "string", + "description": "The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. " + }, + "promotionCode": { + "type": "string", + "description": "A publisher provided promotion code as provisioned in Data Market for the said product/artifact." + }, + "version": { + "type": "string", + "description": "The version of the desired product/artifact." + } + }, + "description": "Plan for the resource.", + "required": [ + "name", + "publisher", + "product" + ] + }, + "ErrorResponse": { + "title": "Error Response", + "description": "Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)", + "type": "object", + "properties": { + "code": { + "readOnly": true, + "type": "string", + "description": "The error code." + }, + "message": { + "readOnly": true, + "type": "string", + "description": "The error message." + }, + "target": { + "readOnly": true, + "type": "string", + "description": "The error target." + }, + "details": { + "readOnly": true, + "type": "array", + "items": { + "$ref": "#/definitions/ErrorResponse" + }, + "description": "The error details." + }, + "additionalInfo": { + "readOnly": true, + "type": "array", + "items": { + "$ref": "#/definitions/ErrorAdditionalInfo" + }, + "description": "The error additional info." + } + } + }, + "ErrorAdditionalInfo": { + "type": "object", + "properties": { + "type": { + "readOnly": true, + "type": "string", + "description": "The additional info type." + }, + "info": { + "readOnly": true, + "type": "object", + "description": "The additional info." + } + }, + "description": "The resource management error additional info." + }, + "Operation": { + "title": "REST API Operation", + "description": "Details of a REST API operation, returned from the Resource Provider Operations API", + "type": "object", + "properties": { + "name": { + "description": "The name of the operation, as per Resource-Based Access Control (RBAC). Examples: \"Microsoft.Compute/virtualMachines/write\", \"Microsoft.Compute/virtualMachines/capture/action\"", + "type": "string", + "readOnly": true + }, + "isDataAction": { + "description": "Whether the operation applies to data-plane. This is \"true\" for data-plane operations and \"false\" for ARM/control-plane operations.", + "type": "boolean", + "readOnly": true + }, + "display": { + "description": "Localized display information for this particular operation.", + "type": "object", + "properties": { + "provider": { + "description": "The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring Insights\" or \"Microsoft Compute\".", + "type": "string", + "readOnly": true + }, + "resource": { + "description": "The localized friendly name of the resource type related to this operation. E.g. \"Virtual Machines\" or \"Job Schedule Collections\".", + "type": "string", + "readOnly": true + }, + "operation": { + "description": "The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create or Update Virtual Machine\", \"Restart Virtual Machine\".", + "type": "string", + "readOnly": true + }, + "description": { + "description": "The short, localized friendly description of the operation; suitable for tool tips and detailed views.", + "type": "string", + "readOnly": true + } + } + }, + "origin": { + "description": "The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is \"user,system\"", + "type": "string", + "readOnly": true, + "enum": [ + "user", + "system", + "user,system" + ], + "x-ms-enum": { + "name": "Origin", + "modelAsString": true + } + }, + "actionType": { + "description": "Enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs.", + "type": "string", + "readOnly": true, + "enum": [ + "Internal" + ], + "x-ms-enum": { + "name": "ActionType", + "modelAsString": true + } + } + } + }, + "OperationListResult": { + "description": "A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results.", + "type": "object", + "properties": { + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "description": "List of operations supported by the resource provider", + "readOnly": true + }, + "nextLink": { + "type": "string", + "description": "URL to get the next set of operation list results (if there are any).", + "readOnly": true + } + } + }, + "locationData": { + "description": "Metadata pertaining to the geographic location of the resource.", + "type": "object", + "properties": { + "name": { + "type": "string", + "maxLength": 256, + "description": "A canonical name for the geographic or physical location." + }, + "city": { + "type": "string", + "description": "The city or locality where the resource is located." + }, + "district": { + "type": "string", + "description": "The district, state, or province where the resource is located." + }, + "countryOrRegion": { + "type": "string", + "description": "The country or region where the resource is located" + } + }, + "required": [ + "name" + ] + }, + "systemData": { + "description": "Metadata pertaining to creation and last modification of the resource.", + "type": "object", + "readOnly": true, + "properties": { + "createdBy": { + "type": "string", + "description": "The identity that created the resource." + }, + "createdByType": { + "type": "string", + "description": "The type of identity that created the resource.", + "enum": [ + "User", + "Application", + "ManagedIdentity", + "Key" + ], + "x-ms-enum": { + "name": "createdByType", + "modelAsString": true + } + }, + "createdAt": { + "type": "string", + "format": "date-time", + "description": "The timestamp of resource creation (UTC)." + }, + "lastModifiedBy": { + "type": "string", + "description": "The identity that last modified the resource." + }, + "lastModifiedByType": { + "type": "string", + "description": "The type of identity that last modified the resource.", + "enum": [ + "User", + "Application", + "ManagedIdentity", + "Key" + ], + "x-ms-enum": { + "name": "createdByType", + "modelAsString": true + } + }, + "lastModifiedAt": { + "type": "string", + "format": "date-time", + "description": "The timestamp of resource last modification (UTC)" + } + } + }, + "encryptionProperties": { + "description": "Configuration of key for data encryption", + "type": "object", + "properties": { + "status": { + "description": "Indicates whether or not the encryption is enabled for container registry.", + "enum": [ + "enabled", + "disabled" + ], + "type": "string", + "x-ms-enum": { + "name": "EncryptionStatus", + "modelAsString": true + } + }, + "keyVaultProperties": { + "$ref": "#/definitions/KeyVaultProperties", + "description": "Key vault properties." + } + } + }, + "KeyVaultProperties": { + "type": "object", + "properties": { + "keyIdentifier": { + "description": "Key vault uri to access the encryption key.", + "type": "string" + }, + "identity": { + "description": "The client ID of the identity which will be used to access key vault.", + "type": "string" + } + } + } + }, + "parameters": { + "SubscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "required": true, + "type": "string", + "description": "The ID of the target subscription.", + "minLength": 1 + }, + "ApiVersionParameter": { + "name": "api-version", + "in": "query", + "required": true, + "type": "string", + "description": "The API version to use for this operation.", + "minLength": 1 + }, + "ResourceGroupNameParameter": { + "name": "resourceGroupName", + "in": "path", + "required": true, + "type": "string", + "description": "The name of the resource group. The name is case insensitive.", + "minLength": 1, + "maxLength": 90, + "x-ms-parameter-location": "method" + } + } +} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/swagger/common/v1/types.json b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/swagger/common/v1/types.json new file mode 100644 index 000000000000..63ed11847851 --- /dev/null +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/swagger/common/v1/types.json @@ -0,0 +1,184 @@ +{ + "swagger": "2.0", + "info": { + "version": "v1", + "title": "Common types" + }, + "paths": {}, + "definitions": { + "ErrorContract": { + "title": "Error details.", + "description": "Contains details when the response code indicates an error.", + "type": "object", + "properties": { + "error": { + "description": "The error details.", + "$ref": "arm-common-types.json#/definitions/ErrorResponse" + } + } + }, + "ErrorDetail": { + "description": "Error details", + "type": "object", + "properties": { + "message": { + "description": "Error message", + "type": "string" + }, + "code": { + "description": "Error code", + "type": "string" + }, + "target": { + "description": "Error target", + "type": "string" + } + } + }, + "WorkspaceSubResource": { + "allOf": [ + { + "$ref": "arm-common-types.json#/definitions/Resource" + }, + { + "properties": { + "location": { + "description": "Location (region) of workspace", + "type": "string" + }, + "tags": { + "type": "object", + "description": "Resource tags", + "additionalProperties": { + "type": "string" + } + } + } + } + ] + }, + "SystemData": { + "description": "ARM System Data.", + "type": "object", + "properties": { + "createdBy": { + "description": "A string identifier for the identity that created the resource.", + "type": "string", + "readOnly": true + }, + "createdByType": { + "description": "The type of identity that created the resource: ", + "enum": [ + "User", + "Application", + "ManagedIdentity", + "Key" + ], + "type": "string", + "readOnly": true + }, + "createdAt": { + "format": "date-time", + "description": "The timestamp of resource creation (UTC).", + "type": "string", + "readOnly": true + }, + "lastModifiedBy": { + "description": "A string identifier for the identity that last modified the resource.", + "type": "string", + "readOnly": true + }, + "lastModifiedByType": { + "description": "The type of identity that last modified the resource: ", + "enum": [ + "User", + "Application", + "ManagedIdentity", + "Key" + ], + "type": "string", + "readOnly": true + }, + "lastModifiedAt": { + "format": "date-time", + "description": "The timestamp of last modification (UTC).", + "type": "string", + "readOnly": true + } + }, + "x-ms-azure-resource": true + }, + "ResourcePropertiesBase": { + "properties": { + "provisioningState": { + "description": "Provisioning state of the resource", + "type": "string" + } + } + }, + "AsyncOperationState": { + "type": "string", + "enum": [ + "None", + "InProgress", + "Succeeded", + "Failed", + "Canceled" + ] + }, + "OperationResource_Common": { + "properties": { + "status": { + "type": "string", + "$ref": "#/definitions/AsyncOperationState" + }, + "error": { + "type": "object", + "$ref": "#/definitions/ErrorDetail" + } + } + } + }, + "parameters": { + "WorkspaceNameParameter": { + "name": "workspaceName", + "in": "path", + "description": "The name of the workspace.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "PrivateLinkHubNameParameter": { + "name": "privateLinkHubName", + "in": "path", + "required": true, + "type": "string", + "description": "Name of the privateLinkHub", + "x-ms-parameter-location": "method" + }, + "SqlPoolNameParameter": { + "name": "sqlPoolName", + "in": "path", + "description": "The name of the sql pool.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "SqlDatabaseNameParameter": { + "name": "sqlDatabaseName", + "in": "path", + "description": "The name of the sql database.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "KeyNameParameter": { + "name": "keyName", + "in": "path", + "description": "The name of a workspace key.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + } + } +} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/swagger/roleAssignments.json b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/swagger/roleAssignments.json new file mode 100644 index 000000000000..b1f50d1b3a17 --- /dev/null +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/swagger/roleAssignments.json @@ -0,0 +1,348 @@ +{ + "swagger": "2.0", + "info": { + "version": "2020-12-01", + "title": "SynapseAdministrationClient" + }, + "x-ms-parameterized-host": { + "hostTemplate": "{endpoint}", + "useSchemePrefix": false, + "parameters": [ + { + "$ref": "#/parameters/Endpoint" + } + ] + }, + "schemes": [ + "https" + ], + "paths": { + "/roleAssignments": { + "get": { + "tags": [ + "RoleAssignments" + ], + "operationId": "SynapseAccessControl_ListRoleAssignments", + "description": "List role assignments.", + "x-ms-examples": { + "List role assignments": { + "$ref": "./examples/SynapseAccessControl_ListRoleAssignments.json" + } + }, + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/RoleIdQueryParameter" + }, + { + "$ref": "#/parameters/PrincipalIdParameter" + }, + { + "$ref": "#/parameters/ScopeParameter" + }, + { + "$ref": "#/parameters/XMsContinuationToken" + } + ], + "responses": { + "200": { + "description": "Success response.", + "headers": { + "x-ms-continuation": { + "description": "If the number of role assignments to be listed exceeds the maxResults limit, a continuation token is returned in this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation of the list operation to continue listing the role assignments.", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/RoleAssignmentDetailsList" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "common/v1/types.json#/definitions/ErrorContract" + } + } + } + } + }, + "/roleAssignments/{roleAssignmentId}": { + "put": { + "tags": [ + "RoleAssignments" + ], + "operationId": "SynapseAccessControl_CreateRoleAssignment", + "description": "Create role assignment.", + "x-ms-examples": { + "Create role assignment": { + "$ref": "./examples/SynapseAccessControl_CreateRoleAssignment.json" + } + }, + "consumes": [ + "application/json", + "text/json" + ], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "request", + "in": "body", + "required": true, + "x-ms-client-flatten": true, + "description": "Details of role id, scope and object id.", + "schema": { + "$ref": "#/definitions/RoleAssignmentRequest" + } + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/RoleAssignmentIdParameter" + } + ], + "responses": { + "200": { + "description": "Success response.", + "schema": { + "$ref": "#/definitions/RoleAssignmentDetails" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "common/v1/types.json#/definitions/ErrorContract" + } + } + } + }, + "get": { + "tags": [ + "RoleAssignments" + ], + "operationId": "SynapseAccessControl_GetRoleAssignmentById", + "description": "Get role assignment by role assignment Id.", + "x-ms-examples": { + "Get role assignment information": { + "$ref": "./examples/SynapseAccessControl_GetRoleAssignmentById.json" + } + }, + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/RoleAssignmentIdParameter" + } + ], + "responses": { + "200": { + "description": "Success response.", + "schema": { + "$ref": "#/definitions/RoleAssignmentDetails" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "common/v1/types.json#/definitions/ErrorContract" + } + } + } + }, + "delete": { + "tags": [ + "RoleAssignments" + ], + "operationId": "SynapseAccessControl_DeleteRoleAssignmentById", + "description": "Delete role assignment by role assignment Id.", + "x-ms-examples": { + "Delete role assignment": { + "$ref": "./examples/SynapseAccessControl_DeleteRoleAssignmentById.json" + } + }, + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/RoleAssignmentIdParameter" + }, + { + "$ref": "#/parameters/ScopeParameter" + } + ], + "responses": { + "200": { + "description": "Success response." + }, + "204": { + "description": "No Content." + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "common/v1/types.json#/definitions/ErrorContract" + } + } + } + } + } + }, + "definitions": { + "RoleAssignmentRequest": { + "description": "Role Assignment request details", + "type": "object", + "required": [ + "roleId", + "principalId", + "scope" + ], + "properties": { + "roleId": { + "description": "Role ID of the Synapse Built-In Role", + "format": "uuid", + "type": "string" + }, + "principalId": { + "description": "Object ID of the AAD principal or security-group", + "format": "uuid", + "type": "string" + }, + "scope": { + "description": "Scope at which the role assignment is created", + "type": "string" + }, + "principalType": { + "description": "Type of the principal Id: User, Group or ServicePrincipal", + "type": "string" + } + } + }, + "RoleAssignmentDetailsList": { + "description": "Role Assignment response details", + "type": "object", + "properties": { + "count": { + "description": "Number of role assignments", + "type": "integer" + }, + "value": { + "description": "A list of role assignments", + "type": "array", + "items": { + "$ref": "#/definitions/RoleAssignmentDetails" + } + } + } + }, + "RoleAssignmentDetails": { + "description": "Role Assignment response details", + "type": "object", + "properties": { + "id": { + "description": "Role Assignment ID", + "type": "string" + }, + "roleDefinitionId": { + "description": "Role ID of the Synapse Built-In Role", + "format": "uuid", + "type": "string" + }, + "principalId": { + "description": "Object ID of the AAD principal or security-group", + "format": "uuid", + "type": "string" + }, + "scope": { + "description": "Scope at the role assignment is created", + "type": "string" + }, + "principalType": { + "description": "Type of the principal Id: User, Group or ServicePrincipal", + "type": "string" + } + } + } + }, + "parameters": { + "Endpoint": { + "name": "endpoint", + "description": "The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net.", + "required": true, + "type": "string", + "in": "path", + "x-ms-skip-url-encoding": true, + "x-ms-parameter-location": "client" + }, + "ApiVersionParameter": { + "name": "api-version", + "in": "query", + "required": true, + "type": "string", + "description": "The Synapse client API Version." + }, + "RoleIdQueryParameter": { + "name": "roleId", + "in": "query", + "required": false, + "type": "string", + "description": "Synapse Built-In Role Id.", + "x-ms-parameter-location": "method" + }, + "PrincipalIdParameter": { + "name": "principalId", + "in": "query", + "required": false, + "type": "string", + "description": "Object ID of the AAD principal or security-group.", + "x-ms-parameter-location": "method" + }, + "RoleAssignmentIdParameter": { + "name": "roleAssignmentId", + "in": "path", + "required": true, + "type": "string", + "description": "The ID of the role assignment.", + "minLength": 1, + "x-ms-parameter-location": "method" + }, + "ScopeParameter": { + "name": "scope", + "in": "query", + "required": false, + "type": "string", + "description": "Scope of the Synapse Built-in Role.", + "x-ms-parameter-location": "method" + }, + "XMsContinuationToken": { + "name": "x-ms-continuation", + "x-ms-client-name": "continuationToken", + "in": "header", + "required": false, + "type": "string", + "description": "Continuation token.", + "x-ms-parameter-location": "method" + } + } +} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/swagger/roleDefinitions.json b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/swagger/roleDefinitions.json new file mode 100644 index 000000000000..3b033ab44a80 --- /dev/null +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/swagger/roleDefinitions.json @@ -0,0 +1,275 @@ +{ + "swagger": "2.0", + "info": { + "version": "2020-12-01", + "title": "SynapseAdministrationClient" + }, + "x-ms-parameterized-host": { + "hostTemplate": "{endpoint}", + "useSchemePrefix": false, + "parameters": [ + { + "$ref": "#/parameters/Endpoint" + } + ] + }, + "schemes": [ + "https" + ], + "paths": { + "/roleDefinitions": { + "get": { + "tags": [ + "SynapseRoleDefinitions" + ], + "operationId": "SynapseAccessControl_ListRoleDefinitions", + "description": "List role definitions.", + "x-ms-examples": { + "List role definitions": { + "$ref": "./examples/SynapseAccessControl_ListRoleDefinitions.json" + } + }, + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/IsBuiltInParameter" + }, + { + "$ref": "#/parameters/ScopeParameter" + } + ], + "responses": { + "200": { + "description": "Success response.", + "schema": { + "$ref": "#/definitions/RoleDefinitionsListResponse" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "common/v1/types.json#/definitions/ErrorContract" + } + } + } + } + }, + "/roleDefinitions/{roleDefinitionId}": { + "get": { + "tags": [ + "SynapseRoleDefinitions" + ], + "operationId": "SynapseAccessControl_GetRoleDefinitionById", + "description": "Get role definition by role definition Id.", + "x-ms-examples": { + "Get role definition information": { + "$ref": "./examples/SynapseAccessControl_GetRoleDefinitionById.json" + } + }, + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/RoleDefinitionIdParameter" + } + ], + "responses": { + "200": { + "description": "Success response.", + "schema": { + "$ref": "#/definitions/SynapseRoleDefinition" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "common/v1/types.json#/definitions/ErrorContract" + } + } + } + } + }, + "/rbacScopes": { + "get": { + "tags": [ + "SynapseRbacScopes" + ], + "operationId": "SynapseAccessControl_ListScopes", + "description": "List rbac scopes.", + "x-ms-examples": { + "List rbac scopes": { + "$ref": "./examples/SynapseAccessControl_ListScopes.json" + } + }, + "consumes": [], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success response.", + "schema": { + "description": "A list of Synapse rbac scopes available.", + "type": "array", + "items": { + "description": "Synapse rbac scope.", + "type": "string" + } + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "common/v1/types.json#/definitions/ErrorContract" + } + } + } + } + } + }, + "definitions": { + "RoleDefinitionsListResponse": { + "description": "A list of Synapse roles available.", + "type": "array", + "items": { + "$ref": "#/definitions/SynapseRoleDefinition" + } + }, + "SynapseRoleDefinition": { + "description": "Synapse role definition details", + "type": "object", + "properties": { + "id": { + "description": "Role Definition ID", + "format": "uuid", + "type": "string" + }, + "name": { + "description": "Name of the Synapse role", + "type": "string" + }, + "isBuiltIn": { + "description": "Is a built-in role or not", + "type": "boolean" + }, + "description": { + "description": "Description for the Synapse role", + "type": "string" + }, + "permissions": { + "description": "Permissions for the Synapse role", + "type": "array", + "items": { + "$ref": "#/definitions/SynapseRbacPermission" + } + }, + "scopes": { + "description": "Allowed scopes for the Synapse role", + "type": "array", + "items": { + "type": "string" + } + }, + "availabilityStatus": { + "description": "Availability of the Synapse role", + "type": "string" + } + } + }, + "SynapseRbacPermission": { + "description": "Synapse role definition details", + "type": "object", + "properties": { + "actions": { + "description": "List of actions", + "type": "array", + "items": { + "type": "string" + } + }, + "notActions": { + "description": "List of Not actions", + "type": "array", + "items": { + "type": "string" + } + }, + "dataActions": { + "description": "List of data actions", + "type": "array", + "items": { + "type": "string" + } + }, + "notDataActions": { + "description": "List of Not data actions", + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "parameters": { + "Endpoint": { + "name": "endpoint", + "description": "The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net.", + "required": true, + "type": "string", + "in": "path", + "x-ms-skip-url-encoding": true, + "x-ms-parameter-location": "client" + }, + "ApiVersionParameter": { + "name": "api-version", + "in": "query", + "required": true, + "type": "string", + "description": "The Synapse client API Version." + }, + "RoleDefinitionIdParameter": { + "name": "roleDefinitionId", + "in": "path", + "required": true, + "type": "string", + "description": "Synapse Built-In Role Definition Id.", + "x-ms-parameter-location": "method" + }, + "IsBuiltInParameter": { + "name": "isBuiltIn", + "in": "query", + "required": false, + "type": "boolean", + "description": "Is a Synapse Built-In Role or not.", + "x-ms-parameter-location": "method" + }, + "ScopeParameter": { + "name": "scope", + "in": "query", + "required": false, + "type": "string", + "description": "Scope of the Synapse Built-in Role.", + "x-ms-parameter-location": "method" + } + } +} diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/AccessControlClientLiveTests.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/AccessControlClientLiveTests.cs index c52fcf61885b..abbc4a2a099c 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/AccessControlClientLiveTests.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/AccessControlClientLiveTests.cs @@ -2,13 +2,10 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Azure.Analytics.Synapse.AccessControl; -using Azure.Analytics.Synapse.AccessControl.Models; -using Azure.Core.TestFramework; using Azure.Analytics.Synapse.Tests; +using Azure.Core.TestFramework; using NUnit.Framework; namespace Azure.Analytics.Synapse.AccessControl.Tests @@ -25,111 +22,156 @@ public class AccessControlClientLiveTests : RecordedTestBase Create (RoleAssignmentsClient assignmentsClient, RoleDefinitionsClient definitionsClient, SynapseTestEnvironment testEnvironment) => - new DisposableClientRole (assignmentsClient, definitionsClient, await CreateResource (assignmentsClient, definitionsClient, testEnvironment)); + public static async ValueTask Create(SynapseAccessControlClient client, SynapseTestEnvironment testEnvironment) => + new DisposableClientRole(client, await CreateResource(client, testEnvironment)); - public static async ValueTask CreateResource (RoleAssignmentsClient assignmentsClient, RoleDefinitionsClient definitionsClient, SynapseTestEnvironment testEnvironment) + public static async ValueTask CreateResource(SynapseAccessControlClient client, SynapseTestEnvironment testEnvironment) { string scope = "workspaces/" + testEnvironment.WorkspaceName; - Guid? roleID = (await definitionsClient.ListRoleDefinitionsAsync()).Value.First (x => x.Name == "Synapse Administrator").Id; + Guid? roleID = new Guid((await client.GetRoleDefinitionsAsync(scope).FirstAsync(x => x.Name == "Synapse Administrator")).Id); Guid principalId = Guid.NewGuid(); - string roleAssignmentId = Guid.NewGuid().ToString(); - return await assignmentsClient.CreateRoleAssignmentAsync(roleAssignmentId, roleID.Value, principalId, scope); + Guid roleAssignmentId = Guid.NewGuid(); + return await client.CreateRoleAssignmentAsync(scope, roleID.Value.ToString(), principalId.ToString(), roleAssignmentId); } public async ValueTask DisposeAsync() { - await _client.DeleteRoleAssignmentByIdAsync(Assignment.Id); + await _client.DeleteRoleAssignmentByIdAsync(Assignment.Id.ToString()); } } - public AccessControlClientLiveTests(bool isAsync) : base(isAsync) + public AccessControlClientLiveTests(bool isAsync) : base(isAsync, RecordedTestMode.Live) { } - private RoleAssignmentsClient CreateAssignmentClient() + private SynapseAccessControlClient CreateClient() { - return InstrumentClient(new RoleAssignmentsClient( + return InstrumentClient(new SynapseAccessControlClient( new Uri(TestEnvironment.EndpointUrl), TestEnvironment.Credential, - InstrumentClientOptions(new AccessControlClientOptions()) + InstrumentClientOptions(new SynapseAdministrationClientOptions()) )); } - private RoleDefinitionsClient CreateDefinitionsClient() + [Test] + public async Task CreateRoleAssignment() { - return InstrumentClient(new RoleDefinitionsClient( - new Uri(TestEnvironment.EndpointUrl), - TestEnvironment.Credential, - InstrumentClientOptions(new AccessControlClientOptions()) - )); + SynapseAccessControlClient client = CreateClient(); + + await using DisposableClientRole role = await DisposableClientRole.Create(client, TestEnvironment); + + Assert.NotNull(role.Assignment.Id); + Assert.NotNull(role.Assignment.Properties.RoleDefinitionId); + Assert.NotNull(role.Assignment.Properties.PrincipalId); } [Test] - public async Task CreateRoleAssignment() + public async Task CreateRoleAssignment_ModelTypeParameterOverload() { - RoleAssignmentsClient assignmentsClient = CreateAssignmentClient(); - RoleDefinitionsClient definitionsClient = CreateDefinitionsClient(); + SynapseAccessControlClient client = CreateClient(); - await using DisposableClientRole role = await DisposableClientRole.Create (assignmentsClient, definitionsClient, TestEnvironment); + string scope = "workspaces/" + TestEnvironment.WorkspaceName; + Guid roleId = new Guid((await client.GetRoleDefinitionsAsync(scope).FirstAsync(x => x.Name == "Synapse Administrator")).Id); + Guid principalId = Guid.NewGuid(); + string roleAssignmentId = Guid.NewGuid().ToString(); - Assert.NotNull(role.Assignment.Id); - Assert.NotNull(role.Assignment.RoleDefinitionId); - Assert.NotNull(role.Assignment.PrincipalId); + SynapseRoleAssignment roleAssignment = new SynapseRoleAssignment(roleId, principalId, scope); + + // Calling the LLC directly: + Response response = await client.CreateRoleAssignmentAsync(roleAssignmentId, roleAssignment, + new RequestOptions() + { + StatusOption = ResponseStatusOption.NoThrow + }); + + // This is the implicit cast -- it will throw if the response is an error + // according to the classifier + SynapseRoleAssignment returnedRoleAssignment = response; + + // But since we suppressed the error, we might want to think + // about it the following way: + if (response.IsError()) + { + await response.ThrowAsync(); + } + else + { + Assert.NotNull(returnedRoleAssignment.Id); + Assert.NotNull(returnedRoleAssignment.Properties.RoleDefinitionId); + Assert.NotNull(returnedRoleAssignment.Properties.PrincipalId); + } } [Test] public async Task GetRoleAssignment() { - RoleAssignmentsClient assignmentsClient = CreateAssignmentClient(); - RoleDefinitionsClient definitionsClient = CreateDefinitionsClient(); + SynapseAccessControlClient client = CreateClient(); - await using DisposableClientRole role = await DisposableClientRole.Create (assignmentsClient, definitionsClient, TestEnvironment); + await using DisposableClientRole role = await DisposableClientRole.Create(client, TestEnvironment); - RoleAssignmentDetails roleAssignment = await assignmentsClient.GetRoleAssignmentByIdAsync(role.Assignment.Id); + // TODO: This string conversion is awkward -- should RoleAssignmentIdParameter be marked as a uuid? + SynapseRoleAssignment roleAssignment = await client.GetRoleAssignmentAsync("", role.Assignment.Id.ToString()); - Assert.AreEqual(role.Assignment.RoleDefinitionId, roleAssignment.RoleDefinitionId); - Assert.AreEqual(role.Assignment.PrincipalId, roleAssignment.PrincipalId); + Assert.AreEqual(role.Assignment.Properties.RoleDefinitionId, roleAssignment.Properties.RoleDefinitionId); + Assert.AreEqual(role.Assignment.Properties.PrincipalId, roleAssignment.Properties.PrincipalId); } [Test] public async Task ListRoleAssignments() { - RoleAssignmentsClient assignmentsClient = CreateAssignmentClient(); - RoleDefinitionsClient definitionsClient = CreateDefinitionsClient(); + SynapseAccessControlClient client = CreateClient(); - await using DisposableClientRole role = await DisposableClientRole.Create (assignmentsClient, definitionsClient, TestEnvironment); + await using DisposableClientRole role = await DisposableClientRole.Create(client, TestEnvironment); - Response> roleAssignments = await definitionsClient.ListRoleDefinitionsAsync(); - foreach (SynapseRoleDefinition expected in roleAssignments.Value) + AsyncPageable roleDefinitions = client.GetRoleDefinitionsAsync(""); + int count = 0; + await foreach (SynapseRoleDefinition expected in roleDefinitions) { - SynapseRoleDefinition actual = await definitionsClient.GetRoleDefinitionByIdAsync(expected.Id.ToString()); + SynapseRoleDefinition actual = await client.GetRoleDefinitionAsync("", new Guid(expected.Id)); Assert.AreEqual(expected.Id, actual.Id); Assert.AreEqual(expected.Name, actual.Name); + count++; } - Assert.GreaterOrEqual(roleAssignments.Value.Count, 1); + Assert.GreaterOrEqual(count, 1); } [Test] public async Task DeleteRoleAssignments() { - RoleAssignmentsClient assignmentsClient = CreateAssignmentClient(); - RoleDefinitionsClient definitionsClient = CreateDefinitionsClient(); + SynapseAccessControlClient client = CreateClient(); - RoleAssignmentDetails assignment = await DisposableClientRole.CreateResource (assignmentsClient, definitionsClient, TestEnvironment); + SynapseRoleAssignment assignment = await DisposableClientRole.CreateResource(client, TestEnvironment); - Response response = await assignmentsClient.DeleteRoleAssignmentByIdAsync (assignment.Id); + // TODO: This string conversion is awkward -- should RoleAssignmentIdParameter be marked as a uuid? + Response response = await client.DeleteRoleAssignmentAsync("", assignment.Id.ToString()); response.AssertSuccess(); } + + [Test] + public async Task GetRbacScopes() + { + SynapseAccessControlClient client = CreateClient(); + + var response = await client.ListScopesAsync(); + } + + //[Test] + //public async Task ListRoleDefinitions() + //{ + // SynapseAccessControlClient client = CreateClient(); + + // client.ListRoleDefinitionsAsync() + + //} } } diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/Azure.Analytics.Synapse.AccessControl.Tests.csproj b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/Azure.Analytics.Synapse.AccessControl.Tests.csproj index 50efa267bd70..0f29ee8d7d09 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/Azure.Analytics.Synapse.AccessControl.Tests.csproj +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/Azure.Analytics.Synapse.AccessControl.Tests.csproj @@ -12,6 +12,7 @@ + diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/samples/Sample1_HelloWorld.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/samples/Sample1_HelloWorld.cs index 1cd02d80863a..65e49ece2d69 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/samples/Sample1_HelloWorld.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/samples/Sample1_HelloWorld.cs @@ -2,72 +2,125 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; -using System.Diagnostics; using System.Linq; -using Azure.Core.TestFramework; +using System.Text.Json; using Azure.Analytics.Synapse.Tests; -using Azure.Analytics.Synapse.AccessControl; -using Azure.Analytics.Synapse.AccessControl.Models; -using Azure.Identity; +using Azure.Core; +using Azure.Core.TestFramework; using NUnit.Framework; namespace Azure.Analytics.Synapse.AccessControl.Samples { /// - /// This sample demonstrates how to submit Spark job in Azure Synapse Analytics using synchronous methods of . /// public partial class Sample1_HelloWorld : SamplesBase { [Test] - public void AddAndRemoveRoleAssignmentSync() + public void AddAndRemoveRoleAssignment_LLC_Sync() { #region Snippet:CreateAccessControlClient // Replace the string below with your actual endpoint url. string endpoint = ""; - /*@@*/endpoint = TestEnvironment.EndpointUrl; + endpoint = TestEnvironment.EndpointUrl; - RoleAssignmentsClient roleAssignmentsClient = new RoleAssignmentsClient(new Uri(endpoint), new DefaultAzureCredential()); - RoleDefinitionsClient definitionsClient = new RoleDefinitionsClient(new Uri(endpoint), new DefaultAzureCredential()); + SynapseAccessControlClient client = new SynapseAccessControlClient(new Uri(endpoint), new DefaultAzureCredential()); #endregion #region Snippet:PrepCreateRoleAssignment - Response> roles = definitionsClient.ListRoleDefinitions(); - SynapseRoleDefinition role = roles.Value.Single(role => role.Name == "Synapse Administrator"); - Guid roleId = role.Id.Value; + Response listRoleDefinitionsResponse = client.ListRoleDefinitions(); + JsonDocument roleDefinitions = JsonDocument.Parse(listRoleDefinitionsResponse.Content.ToMemory()); + + JsonElement roleDefinition = roleDefinitions.RootElement.EnumerateArray().Single(role => role.GetProperty("name").ToString() == "Synapse Administrator"); + string roleId = roleDefinition.GetProperty("id").ToString(); string assignedScope = "workspaces/"; - /*@@*/assignedScope = "workspaces/" + TestEnvironment.WorkspaceName; + assignedScope = "workspaces/" + TestEnvironment.WorkspaceName; // Replace the string below with the ID you'd like to assign the role. Guid principalId = /*"*/ Guid.NewGuid(); // Replace the string below with the ID of the assignment you'd like to use. - string assignmentId = ""; - /*@@*/assignmentId = Guid.NewGuid().ToString(); + string assignmentId = /*""*/ Guid.NewGuid().ToString(); #endregion #region Snippet:CreateRoleAssignment - Response response = roleAssignmentsClient.CreateRoleAssignment (assignmentId, roleId, principalId, assignedScope); - RoleAssignmentDetails roleAssignmentAdded = response.Value; + Response createRoleAssignmentResponse = client.CreateRoleAssignment( + assignmentId, + RequestContent.Create( + new + { + RoleId = roleId, + PrincipalId = principalId, + Scope = assignedScope + })); + JsonDocument roleAssignment = JsonDocument.Parse(createRoleAssignmentResponse.Content.ToMemory()); + string roleAssignmentId = roleAssignment.RootElement.GetProperty("id").ToString(); + string roleDefinitionId = roleAssignment.RootElement.GetProperty("roleDefinitionId").ToString(); + string roleAssignmentPrincipalId = roleAssignment.RootElement.GetProperty("principalId").ToString(); + string roleAssignmentScope = roleAssignment.RootElement.GetProperty("scope").ToString(); #endregion + } + + [Test] + public void AddRoleAssignment_HLC_Sync() + { + #region Snippet:CreateAccessControlClient + // Replace the string below with your actual endpoint url. + string endpoint = ""; + endpoint = TestEnvironment.EndpointUrl; - #region Snippet:RetrieveRoleAssignment - RoleAssignmentDetails roleAssignment = roleAssignmentsClient.GetRoleAssignmentById(roleAssignmentAdded.Id); - Console.WriteLine($"Role {roleAssignment.RoleDefinitionId} is assigned to {roleAssignment.PrincipalId}."); + SynapseAccessControlClient client = new SynapseAccessControlClient(new Uri(endpoint), new DefaultAzureCredential()); #endregion - #region Snippet:ListRoleAssignments - Response> roleAssignments = definitionsClient.ListRoleDefinitions(); - foreach (SynapseRoleDefinition assignment in roleAssignments.Value) - { - Console.WriteLine(assignment.Id); - } + #region Snippet:PrepCreateRoleAssignment + Response listRoleDefinitionsResponse = client.ListRoleDefinitions(); + JsonDocument roleDefinitions = JsonDocument.Parse(listRoleDefinitionsResponse.Content.ToMemory()); + + ////SynapseRoleDefinition role = roles.Value.Single(role => role.Name == "Synapse Administrator"); + ////Guid roleId = role.Id.Value; + JsonElement roleDefinition = roleDefinitions.RootElement.EnumerateArray().Single(role => role.GetProperty("name").ToString() == "Synapse Administrator"); + string roleId = roleDefinition.GetProperty("id").ToString(); + + string assignedScope = "workspaces/"; + assignedScope = "workspaces/" + TestEnvironment.WorkspaceName; + + // Replace the string below with the ID you'd like to assign the role. + Guid principalId = /*"*/ Guid.NewGuid(); + + // Replace the string below with the ID of the assignment you'd like to use. + Guid assignmentId = /*""*/ Guid.NewGuid(); #endregion - #region Snippet:DeleteRoleAssignment - roleAssignmentsClient.DeleteRoleAssignmentById(roleAssignment.Id); + #region Snippet:CreateRoleAssignment + + SynapseRoleAssignment roleAssignment = client.CreateRoleAssignment(SynapseRoleScope.Global, roleId, principalId.ToString(), assignmentId); + Guid roleAssignmentId = roleAssignment.Id; + Guid roleDefinitionId = roleAssignment.Properties.RoleDefinitionId; + Guid roleAssignmentPrincipalId = roleAssignment.Properties.PrincipalId; + string roleAssignmentScope = roleAssignment.Properties.Scope?.ToString(); + #endregion } + + public void RemoveRoleAssignment_LLC_Sync() + { + // TODO: Add these + //#region Snippet:RetrieveRoleAssignment + //RoleAssignmentDetails roleAssignment = roleAssignmentsClient.GetRoleAssignmentById(roleAssignmentAdded.Id); + //Console.WriteLine($"Role {roleAssignment.RoleDefinitionId} is assigned to {roleAssignment.PrincipalId}."); + //#endregion + + //#region Snippet:ListRoleAssignments + //Response> roleAssignments = definitionsClient.ListRoleDefinitions(); + //foreach (SynapseRoleDefinition assignment in roleAssignments.Value) + //{ + // Console.WriteLine(assignment.Id); + //} + //#endregion + + //#region Snippet:DeleteRoleAssignment + //roleAssignmentsClient.DeleteRoleAssignmentById(roleAssignment.Id); + //#endregion + } } } diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Azure.Analytics.Synapse.Artifacts.csproj b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Azure.Analytics.Synapse.Artifacts.csproj index 70437c33a89f..1daf3a7bda92 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Azure.Analytics.Synapse.Artifacts.csproj +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Azure.Analytics.Synapse.Artifacts.csproj @@ -37,5 +37,9 @@ + + + + diff --git a/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/src/Azure.Analytics.Synapse.ManagedPrivateEndpoints.csproj b/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/src/Azure.Analytics.Synapse.ManagedPrivateEndpoints.csproj index 4ecaa9333be0..3e85530abe18 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/src/Azure.Analytics.Synapse.ManagedPrivateEndpoints.csproj +++ b/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/src/Azure.Analytics.Synapse.ManagedPrivateEndpoints.csproj @@ -37,5 +37,9 @@ + + + + diff --git a/sdk/synapse/Azure.Analytics.Synapse.Monitoring/src/Azure.Analytics.Synapse.Monitoring.csproj b/sdk/synapse/Azure.Analytics.Synapse.Monitoring/src/Azure.Analytics.Synapse.Monitoring.csproj index a837b7ffcfe5..1e05f94afeba 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Monitoring/src/Azure.Analytics.Synapse.Monitoring.csproj +++ b/sdk/synapse/Azure.Analytics.Synapse.Monitoring/src/Azure.Analytics.Synapse.Monitoring.csproj @@ -37,5 +37,9 @@ + + + + diff --git a/sdk/synapse/Azure.Analytics.Synapse.Spark/src/Azure.Analytics.Synapse.Spark.csproj b/sdk/synapse/Azure.Analytics.Synapse.Spark/src/Azure.Analytics.Synapse.Spark.csproj index 89d64c1d254f..95dae92494fc 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Spark/src/Azure.Analytics.Synapse.Spark.csproj +++ b/sdk/synapse/Azure.Analytics.Synapse.Spark/src/Azure.Analytics.Synapse.Spark.csproj @@ -39,5 +39,9 @@ + + + + diff --git a/sdk/synapse/Azure.Analytics.Synapse.sln b/sdk/synapse/Azure.Analytics.Synapse.sln index 8be378f54fee..77e004e47961 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.sln +++ b/sdk/synapse/Azure.Analytics.Synapse.sln @@ -29,6 +29,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Analytics.Synapse.Mon EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Analytics.Synapse.Monitoring.Tests", "Azure.Analytics.Synapse.Monitoring\tests\Azure.Analytics.Synapse.Monitoring.Tests.csproj", "{729E92B7-E47B-442C-836F-27B8A7806D2F}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core", "..\core\Azure.Core\src\Azure.Core.csproj", "{431E8B75-EE0F-46E9-BC1A-2BC4436E8C5D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.Experimental", "..\core\Azure.Core.Experimental\src\Azure.Core.Experimental.csproj", "{8D8EB800-3496-4E0D-A2D0-F46CC2BA44DB}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution Azure.Analytics.Synapse.Shared\tests\Azure.Analytics.Synapse.Shared.Tests.projitems*{1afa2644-a1d9-419f-b87d-9b519b673f24}*SharedItemsImports = 13 @@ -93,6 +97,14 @@ Global {729E92B7-E47B-442C-836F-27B8A7806D2F}.Debug|Any CPU.Build.0 = Debug|Any CPU {729E92B7-E47B-442C-836F-27B8A7806D2F}.Release|Any CPU.ActiveCfg = Release|Any CPU {729E92B7-E47B-442C-836F-27B8A7806D2F}.Release|Any CPU.Build.0 = Release|Any CPU + {431E8B75-EE0F-46E9-BC1A-2BC4436E8C5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {431E8B75-EE0F-46E9-BC1A-2BC4436E8C5D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {431E8B75-EE0F-46E9-BC1A-2BC4436E8C5D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {431E8B75-EE0F-46E9-BC1A-2BC4436E8C5D}.Release|Any CPU.Build.0 = Release|Any CPU + {8D8EB800-3496-4E0D-A2D0-F46CC2BA44DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8D8EB800-3496-4E0D-A2D0-F46CC2BA44DB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8D8EB800-3496-4E0D-A2D0-F46CC2BA44DB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8D8EB800-3496-4E0D-A2D0-F46CC2BA44DB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE