Ejemplo n.º 1
0
 public virtual Response <MachineExtension> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _machineExtensionClientDiagnostics.CreateScope("MachineExtension.Get");
     scope.Start();
     try
     {
         var response = _machineExtensionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw _machineExtensionClientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new MachineExtension(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
Ejemplo n.º 2
0
        public virtual Response <MachineExtension> Get(string extensionName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(extensionName, nameof(extensionName));

            using var scope = _machineExtensionClientDiagnostics.CreateScope("MachineExtensionCollection.Get");
            scope.Start();
            try
            {
                var response = _machineExtensionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, extensionName, cancellationToken);
                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new MachineExtension(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }