public virtual ServiceDeleteBastionShareableLinkOperation StartDeleteBastionShareableLink(string resourceGroupName, string bastionHostName, BastionShareableLinkListRequest bslRequest, CancellationToken cancellationToken = default)
        {
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (bastionHostName == null)
            {
                throw new ArgumentNullException(nameof(bastionHostName));
            }
            if (bslRequest == null)
            {
                throw new ArgumentNullException(nameof(bslRequest));
            }

            using var scope = _clientDiagnostics.CreateScope("ServiceOperations.StartDeleteBastionShareableLink");
            scope.Start();
            try
            {
                var originalResponse = RestClient.DeleteBastionShareableLink(resourceGroupName, bastionHostName, bslRequest, cancellationToken);
                return(new ServiceDeleteBastionShareableLinkOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteBastionShareableLinkRequest(resourceGroupName, bastionHostName, bslRequest).Request, originalResponse));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Beispiel #2
0
        public virtual async Task <ServicePutBastionShareableLinkOperation> StartPutBastionShareableLinkAsync(string resourceGroupName, string bastionHostName, BastionShareableLinkListRequest bslRequest, CancellationToken cancellationToken = default)
        {
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (bastionHostName == null)
            {
                throw new ArgumentNullException(nameof(bastionHostName));
            }
            if (bslRequest == null)
            {
                throw new ArgumentNullException(nameof(bslRequest));
            }

            using var scope = _clientDiagnostics.CreateScope("ServiceClient.StartPutBastionShareableLink");
            scope.Start();
            try
            {
                var originalResponse = await RestClient.PutBastionShareableLinkAsync(resourceGroupName, bastionHostName, bslRequest, cancellationToken).ConfigureAwait(false);

                return(new ServicePutBastionShareableLinkOperation(_clientDiagnostics, _pipeline, RestClient.CreatePutBastionShareableLinkRequest(resourceGroupName, bastionHostName, bslRequest).Request, originalResponse));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
        public virtual Pageable <BastionShareableLink> GetBastionShareableLink(string resourceGroupName, string bastionHostName, BastionShareableLinkListRequest bslRequest, CancellationToken cancellationToken = default)
        {
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (bastionHostName == null)
            {
                throw new ArgumentNullException(nameof(bastionHostName));
            }
            if (bslRequest == null)
            {
                throw new ArgumentNullException(nameof(bslRequest));
            }

            Page <BastionShareableLink> FirstPageFunc(int?pageSizeHint)
            {
                using var scope = _clientDiagnostics.CreateScope("ServiceOperations.GetBastionShareableLink");
                scope.Start();
                try
                {
                    var response = RestClient.GetBastionShareableLink(resourceGroupName, bastionHostName, bslRequest, cancellationToken);
                    return(Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()));
                }
                catch (Exception e)
                {
                    scope.Failed(e);
                    throw;
                }
            }

            Page <BastionShareableLink> NextPageFunc(string nextLink, int?pageSizeHint)
            {
                using var scope = _clientDiagnostics.CreateScope("ServiceOperations.GetBastionShareableLink");
                scope.Start();
                try
                {
                    var response = RestClient.GetBastionShareableLinkNextPage(nextLink, resourceGroupName, bastionHostName, bslRequest, cancellationToken);
                    return(Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()));
                }
                catch (Exception e)
                {
                    scope.Failed(e);
                    throw;
                }
            }

            return(PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc));
        }
Beispiel #4
0
 /// <summary>
 /// Creates a Bastion Shareable Links for all the VMs specified in the request.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='bastionHostName'>
 /// The name of the Bastion Host.
 /// </param>
 /// <param name='bslRequest'>
 /// Post request for all the Bastion Shareable Link endpoints.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IPage <BastionShareableLink> > PutBastionShareableLinkAsync(this INetworkManagementClient operations, string resourceGroupName, string bastionHostName, BastionShareableLinkListRequest bslRequest, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.PutBastionShareableLinkWithHttpMessagesAsync(resourceGroupName, bastionHostName, bslRequest, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Beispiel #5
0
 /// <summary>
 /// Deletes the Bastion Shareable Links for all the VMs specified in the
 /// request.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='bastionHostName'>
 /// The name of the Bastion Host.
 /// </param>
 /// <param name='bslRequest'>
 /// Post request for all the Bastion Shareable Link endpoints.
 /// </param>
 public static void DeleteBastionShareableLink(this INetworkManagementClient operations, string resourceGroupName, string bastionHostName, BastionShareableLinkListRequest bslRequest)
 {
     operations.DeleteBastionShareableLinkAsync(resourceGroupName, bastionHostName, bslRequest).GetAwaiter().GetResult();
 }
Beispiel #6
0
 /// <summary>
 /// Creates a Bastion Shareable Links for all the VMs specified in the request.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='bastionHostName'>
 /// The name of the Bastion Host.
 /// </param>
 /// <param name='bslRequest'>
 /// Post request for all the Bastion Shareable Link endpoints.
 /// </param>
 public static IPage <BastionShareableLink> BeginPutBastionShareableLink(this INetworkManagementClient operations, string resourceGroupName, string bastionHostName, BastionShareableLinkListRequest bslRequest)
 {
     return(operations.BeginPutBastionShareableLinkAsync(resourceGroupName, bastionHostName, bslRequest).GetAwaiter().GetResult());
 }
Beispiel #7
0
 /// <summary>
 /// Deletes the Bastion Shareable Links for all the VMs specified in the
 /// request.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='bastionHostName'>
 /// The name of the Bastion Host.
 /// </param>
 /// <param name='bslRequest'>
 /// Post request for all the Bastion Shareable Link endpoints.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task BeginDeleteBastionShareableLinkAsync(this INetworkManagementClient operations, string resourceGroupName, string bastionHostName, BastionShareableLinkListRequest bslRequest, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.BeginDeleteBastionShareableLinkWithHttpMessagesAsync(resourceGroupName, bastionHostName, bslRequest, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
        public async Task <Response> PutBastionShareableLinkAsync(string resourceGroupName, string bastionHostName, BastionShareableLinkListRequest bslRequest, CancellationToken cancellationToken = default)
        {
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (bastionHostName == null)
            {
                throw new ArgumentNullException(nameof(bastionHostName));
            }
            if (bslRequest == null)
            {
                throw new ArgumentNullException(nameof(bslRequest));
            }

            using var message = CreatePutBastionShareableLinkRequest(resourceGroupName, bastionHostName, bslRequest);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            case 202:
                return(message.Response);

            default:
                throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
            }
        }
        internal HttpMessage CreatePutBastionShareableLinkRequest(string resourceGroupName, string bastionHostName, BastionShareableLinkListRequest bslRequest)
        {
            var message = _pipeline.CreateMessage();
            var request = message.Request;

            request.Method = RequestMethod.Post;
            var uri = new RawRequestUriBuilder();

            uri.Reset(endpoint);
            uri.AppendPath("/subscriptions/", false);
            uri.AppendPath(subscriptionId, true);
            uri.AppendPath("/resourceGroups/", false);
            uri.AppendPath(resourceGroupName, true);
            uri.AppendPath("/providers/Microsoft.Network/bastionHosts/", false);
            uri.AppendPath(bastionHostName, true);
            uri.AppendPath("/createShareableLinks", false);
            uri.AppendQuery("api-version", "2020-04-01", true);
            request.Uri = uri;
            request.Headers.Add("Content-Type", "application/json");
            var content = new Utf8JsonRequestContent();

            content.JsonWriter.WriteObjectValue(bslRequest);
            request.Content = content;
            return(message);
        }
        public async Task <Response <BastionShareableLinkListResult> > GetBastionShareableLinkAsync(string resourceGroupName, string bastionHostName, BastionShareableLinkListRequest bslRequest, CancellationToken cancellationToken = default)
        {
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (bastionHostName == null)
            {
                throw new ArgumentNullException(nameof(bastionHostName));
            }
            if (bslRequest == null)
            {
                throw new ArgumentNullException(nameof(bslRequest));
            }

            using var message = CreateGetBastionShareableLinkRequest(resourceGroupName, bastionHostName, bslRequest);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            {
                BastionShareableLinkListResult value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                if (document.RootElement.ValueKind == JsonValueKind.Null)
                {
                    value = null;
                }
                else
                {
                    value = BastionShareableLinkListResult.DeserializeBastionShareableLinkListResult(document.RootElement);
                }
                return(Response.FromValue(value, message.Response));
            }
        public Response DeleteBastionShareableLink(string resourceGroupName, string bastionHostName, BastionShareableLinkListRequest bslRequest, CancellationToken cancellationToken = default)
        {
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (bastionHostName == null)
            {
                throw new ArgumentNullException(nameof(bastionHostName));
            }
            if (bslRequest == null)
            {
                throw new ArgumentNullException(nameof(bslRequest));
            }

            using var message = CreateDeleteBastionShareableLinkRequest(resourceGroupName, bastionHostName, bslRequest);
            _pipeline.Send(message, cancellationToken);
            switch (message.Response.Status)
            {
            case 200:
            case 202:
                return(message.Response);

            default:
                throw _clientDiagnostics.CreateRequestFailedException(message.Response);
            }
        }
Beispiel #12
0
        public virtual NetworkManagementPutBastionShareableLinkOperation StartPutBastionShareableLink(string resourceGroupName, string bastionHostName, BastionShareableLinkListRequest bslRequest, CancellationToken cancellationToken = default)
        {
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (bastionHostName == null)
            {
                throw new ArgumentNullException(nameof(bastionHostName));
            }
            if (bslRequest == null)
            {
                throw new ArgumentNullException(nameof(bslRequest));
            }

            using var scope = _clientDiagnostics.CreateScope("NetworkManagementOperations.StartPutBastionShareableLink");
            scope.Start();
            try
            {
                var originalResponse = RestClient.PutBastionShareableLink(resourceGroupName, bastionHostName, bslRequest, cancellationToken);
                return(new NetworkManagementPutBastionShareableLinkOperation(_clientDiagnostics, _pipeline, RestClient.CreatePutBastionShareableLinkRequest(resourceGroupName, bastionHostName, bslRequest).Request, originalResponse, nextLink => RestClient.PutBastionShareableLinkNextPageAsync(nextLink, resourceGroupName, bastionHostName, bslRequest, cancellationToken)));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }