示例#1
0
 public virtual Response <NetworkProfile> Get(string expand = null, CancellationToken cancellationToken = default)
 {
     using var scope = _networkProfileClientDiagnostics.CreateScope("NetworkProfile.Get");
     scope.Start();
     try
     {
         var response = _networkProfileRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken);
         if (response.Value == null)
         {
             throw _networkProfileClientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new NetworkProfile(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
        public virtual Response <NetworkProfile> Get(string networkProfileName, string expand = null, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("NetworkProfileCollection.Get");
            scope.Start();
            try
            {
                if (networkProfileName == null)
                {
                    throw new ArgumentNullException(nameof(networkProfileName));
                }

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