Esempio n. 1
0
 public virtual Response <ManagedDiskResource> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _managedDiskDisksClientDiagnostics.CreateScope("ManagedDiskResource.Get");
     scope.Start();
     try
     {
         var response = _managedDiskDisksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw new RequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new ManagedDiskResource(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
Esempio n. 2
0
 public virtual Response <Disk> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("Disk.Get");
     scope.Start();
     try
     {
         var response = _restClient.Get(Id.ResourceGroupName, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new Disk(this, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
Esempio n. 3
0
        public virtual Response <Disk> Get(string diskName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(diskName, nameof(diskName));

            using var scope = _diskClientDiagnostics.CreateScope("DiskCollection.Get");
            scope.Start();
            try
            {
                var response = _diskRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, diskName, cancellationToken);
                if (response.Value == null)
                {
                    throw _diskClientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new Disk(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
        public virtual Response <Disk> Get(string diskName, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("DiskContainer.Get");
            scope.Start();
            try
            {
                if (diskName == null)
                {
                    throw new ArgumentNullException(nameof(diskName));
                }

                var response = _restClient.Get(Id.ResourceGroupName, diskName, cancellationToken: cancellationToken);
                if (response.Value == null)
                {
                    throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new Disk(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }