Ejemplo n.º 1
0
        public async virtual Task <Response <DatabaseAccountMongodbDatabaseThroughputSetting> > GetAsync(CancellationToken cancellationToken = default)
        {
            using var scope = _databaseAccountMongodbDatabaseThroughputSettingMongoDBResourcesClientDiagnostics.CreateScope("DatabaseAccountMongodbDatabaseThroughputSetting.Get");
            scope.Start();
            try
            {
                var response = await _databaseAccountMongodbDatabaseThroughputSettingMongoDBResourcesRestClient.GetMongoDBDatabaseThroughputAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw await _databaseAccountMongodbDatabaseThroughputSettingMongoDBResourcesClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false);
                }
                return(Response.FromValue(new DatabaseAccountMongodbDatabaseThroughputSetting(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }