public async virtual Task <Response <DeploymentScript> > GetAsync(string scriptName, CancellationToken cancellationToken = default) { if (scriptName == null) { throw new ArgumentNullException(nameof(scriptName)); } using var scope = _clientDiagnostics.CreateScope("DeploymentScriptCollection.Get"); scope.Start(); try { var response = await _deploymentScriptsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, scriptName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new DeploymentScript(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <ArmDeploymentScriptResource> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _armDeploymentScriptDeploymentScriptsClientDiagnostics.CreateScope("ArmDeploymentScriptResource.Get"); scope.Start(); try { var response = await _armDeploymentScriptDeploymentScriptsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new ArmDeploymentScriptResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <Response <DeploymentScript> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("DeploymentScript.Get"); scope.Start(); try { var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new DeploymentScript(this, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }