コード例 #1
0
        public virtual async Task <Response <ImmutabilityPolicy> > GetImmutabilityPolicyAsync(string ifMatch = null, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("BlobContainer.GetImmutabilityPolicy");
            scope.Start();
            try
            {
                var response = await _restClient.GetImmutabilityPolicyAsync(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false);

                return(response);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
コード例 #2
0
        public async virtual Task <Response <ImmutabilityPolicy> > GetAsync(string ifMatch = null, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("ImmutabilityPolicy.Get");
            scope.Start();
            try
            {
                var response = await _blobContainersRestClient.GetImmutabilityPolicyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Name, ifMatch, cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false);
                }
                return(Response.FromValue(new ImmutabilityPolicy(this, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }