コード例 #1
0
        public virtual Response <SqlTimeZone> Get(string locationName, string timeZoneId, CancellationToken cancellationToken = default)
        {
            if (locationName == null)
            {
                throw new ArgumentNullException(nameof(locationName));
            }
            if (timeZoneId == null)
            {
                throw new ArgumentNullException(nameof(timeZoneId));
            }

            using var scope = _clientDiagnostics.CreateScope("SqlTimeZoneCollection.Get");
            scope.Start();
            try
            {
                var response = _timeZonesRestClient.Get(Id.SubscriptionId, locationName, timeZoneId, cancellationToken);
                if (response.Value == null)
                {
                    throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new SqlTimeZone(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
コード例 #2
0
        public virtual Response <SqlTimeZoneResource> Get(string timeZoneId, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(timeZoneId, nameof(timeZoneId));

            using var scope = _sqlTimeZoneTimeZonesClientDiagnostics.CreateScope("SqlTimeZoneCollection.Get");
            scope.Start();
            try
            {
                var response = _sqlTimeZoneTimeZonesRestClient.Get(Id.SubscriptionId, _locationName, timeZoneId, cancellationToken);
                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new SqlTimeZoneResource(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
コード例 #3
0
 public virtual Response <SqlTimeZone> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _sqlTimeZoneTimeZonesClientDiagnostics.CreateScope("SqlTimeZone.Get");
     scope.Start();
     try
     {
         var response = _sqlTimeZoneTimeZonesRestClient.Get(Id.SubscriptionId, Id.Parent.Name, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw new RequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new SqlTimeZone(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }