Example #1
0
        public virtual Response <DeletedManagedHsm> Get(string location, string name, CancellationToken cancellationToken = default)
        {
            if (location == null)
            {
                throw new ArgumentNullException(nameof(location));
            }
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            using var scope = _clientDiagnostics.CreateScope("DeletedManagedHsmCollection.Get");
            scope.Start();
            try
            {
                var response = _managedHsmsRestClient.GetDeleted(Id.SubscriptionId, location, name, cancellationToken);
                if (response.Value == null)
                {
                    throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new DeletedManagedHsm(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Example #2
0
        public virtual Response <DeletedManagedHsmResource> Get(AzureLocation location, string name, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(name, nameof(name));

            using var scope = _deletedManagedHsmManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmCollection.Get");
            scope.Start();
            try
            {
                var response = _deletedManagedHsmManagedHsmsRestClient.GetDeleted(Id.SubscriptionId, location, name, cancellationToken);
                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new DeletedManagedHsmResource(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Example #3
0
 public virtual Response <DeletedManagedHsm> GetDeleted(CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("ManagedHsm.GetDeleted");
     scope.Start();
     try
     {
         var response = _restClient.GetDeleted(Id.Parent.Name, Id.Name, cancellationToken);
         return(response);
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
Example #4
0
 public virtual Response <DeletedManagedHsm> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _deletedManagedHsmManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsm.Get");
     scope.Start();
     try
     {
         var response = _deletedManagedHsmManagedHsmsRestClient.GetDeleted(Id.SubscriptionId, Id.Parent.Name, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw new RequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new DeletedManagedHsm(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }