public async virtual Task <Response <AfdSecret> > GetAsync(string secretName, CancellationToken cancellationToken = default) { if (secretName == null) { throw new ArgumentNullException(nameof(secretName)); } using var scope = _clientDiagnostics.CreateScope("AfdSecretCollection.Get"); scope.Start(); try { var response = await _afdSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new AfdSecret(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <AfdSecretResource> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _afdSecretClientDiagnostics.CreateScope("AfdSecretResource.Get"); scope.Start(); try { var response = await _afdSecretRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new AfdSecretResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }