Skip to content

Commit

Permalink
.NET SDK Resource Provider:'Blueprint'
Browse files Browse the repository at this point in the history
REST Spec PR 'Azure/azure-rest-api-specs#5470'
REST Spec PR Author 'filizt'
REST Spec PR Last commit
  • Loading branch information
adxsdknet committed Mar 26, 2019
1 parent 81fb68d commit 00d93e7
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,14 @@ internal AssignmentsOperations(BlueprintManagementClient client)
/// <summary>
/// Get Blueprints service SPN objectId
/// </summary>
/// <param name='scope'>
/// The scope of the resource. Valid scopes are: management group (format:
/// '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
/// subscription (format: '/subscriptions/{subscriptionId}').
/// </param>
/// <param name='assignmentName'>
/// Name of the blueprint assignment.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
Expand All @@ -662,25 +670,51 @@ internal AssignmentsOperations(BlueprintManagementClient client)
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<WhoIsBlueprintContract>> WhoIsBlueprintWithHttpMessagesAsync(Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<AzureOperationResponse<WhoIsBlueprintContract>> WhoIsBlueprintWithHttpMessagesAsync(string scope, string assignmentName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
if (scope == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "scope");
}
if (assignmentName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "assignmentName");
}
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("scope", scope);
tracingParameters.Add("assignmentName", assignmentName);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "WhoIsBlueprint", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}/WhoIsBlueprint").ToString();
_url = _url.Replace("{scope}", scope);
_url = _url.Replace("{assignmentName}", System.Uri.EscapeDataString(assignmentName));
List<string> _queryParameters = new List<string>();
if (Client.ApiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,17 @@ public static Assignment Delete(this IAssignmentsOperations operations, string s
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
public static WhoIsBlueprintContract WhoIsBlueprint(this IAssignmentsOperations operations)
/// <param name='scope'>
/// The scope of the resource. Valid scopes are: management group (format:
/// '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
/// subscription (format: '/subscriptions/{subscriptionId}').
/// </param>
/// <param name='assignmentName'>
/// Name of the blueprint assignment.
/// </param>
public static WhoIsBlueprintContract WhoIsBlueprint(this IAssignmentsOperations operations, string scope, string assignmentName)
{
return operations.WhoIsBlueprintAsync().GetAwaiter().GetResult();
return operations.WhoIsBlueprintAsync(scope, assignmentName).GetAwaiter().GetResult();
}

/// <summary>
Expand All @@ -176,12 +184,20 @@ public static WhoIsBlueprintContract WhoIsBlueprint(this IAssignmentsOperations
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='scope'>
/// The scope of the resource. Valid scopes are: management group (format:
/// '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
/// subscription (format: '/subscriptions/{subscriptionId}').
/// </param>
/// <param name='assignmentName'>
/// Name of the blueprint assignment.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<WhoIsBlueprintContract> WhoIsBlueprintAsync(this IAssignmentsOperations operations, CancellationToken cancellationToken = default(CancellationToken))
public static async Task<WhoIsBlueprintContract> WhoIsBlueprintAsync(this IAssignmentsOperations operations, string scope, string assignmentName, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.WhoIsBlueprintWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
using (var _result = await operations.WhoIsBlueprintWithHttpMessagesAsync(scope, assignmentName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ public partial interface IAssignmentsOperations
/// <summary>
/// Get Blueprints service SPN objectId
/// </summary>
/// <param name='scope'>
/// The scope of the resource. Valid scopes are: management group
/// (format:
/// '/providers/Microsoft.Management/managementGroups/{managementGroup}'),
/// subscription (format: '/subscriptions/{subscriptionId}').
/// </param>
/// <param name='assignmentName'>
/// Name of the blueprint assignment.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
Expand All @@ -125,7 +134,10 @@ public partial interface IAssignmentsOperations
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
Task<AzureOperationResponse<WhoIsBlueprintContract>> WhoIsBlueprintWithHttpMessagesAsync(Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<WhoIsBlueprintContract>> WhoIsBlueprintWithHttpMessagesAsync(string scope, string assignmentName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// List blueprint assignments within a subscription.
/// </summary>
Expand Down

0 comments on commit 00d93e7

Please sign in to comment.