Пример #1
0
        public async virtual Task <Response <ServerTrustGroup> > GetAsync(string locationName, string serverTrustGroupName, CancellationToken cancellationToken = default)
        {
            if (locationName == null)
            {
                throw new ArgumentNullException(nameof(locationName));
            }
            if (serverTrustGroupName == null)
            {
                throw new ArgumentNullException(nameof(serverTrustGroupName));
            }

            using var scope = _clientDiagnostics.CreateScope("ServerTrustGroupCollection.Get");
            scope.Start();
            try
            {
                var response = await _serverTrustGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, locationName, serverTrustGroupName, cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false);
                }
                return(Response.FromValue(new ServerTrustGroup(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Пример #2
0
        public virtual async Task <Response <ServerTrustGroupResource> > GetAsync(string serverTrustGroupName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(serverTrustGroupName, nameof(serverTrustGroupName));

            using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ServerTrustGroupCollection.Get");
            scope.Start();
            try
            {
                var response = await _serverTrustGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _locationName, serverTrustGroupName, cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new ServerTrustGroupResource(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Пример #3
0
        public virtual async Task <Response <ServerTrustGroup> > GetAsync(CancellationToken cancellationToken = default)
        {
            using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ServerTrustGroup.Get");
            scope.Start();
            try
            {
                var response = await _serverTrustGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new ServerTrustGroup(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }