Beispiel #1
0
        public virtual async Task <Response <DataPolicyManifest> > GetAsync(string policyMode, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(policyMode, nameof(policyMode));

            using var scope = _dataPolicyManifestClientDiagnostics.CreateScope("DataPolicyManifestCollection.Get");
            scope.Start();
            try
            {
                var response = await _dataPolicyManifestRestClient.GetByPolicyModeAsync(policyMode, cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new DataPolicyManifest(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Beispiel #2
0
        public async virtual Task <Response <DataPolicyManifest> > GetAsync(CancellationToken cancellationToken = default)
        {
            using var scope = _dataPolicyManifestClientDiagnostics.CreateScope("DataPolicyManifest.Get");
            scope.Start();
            try
            {
                var response = await _dataPolicyManifestRestClient.GetByPolicyModeAsync(Id.Name, cancellationToken).ConfigureAwait(false);

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