public virtual Response <DeploymentScript> Get(CancellationToken cancellationToken = default) { using var scope = _deploymentScriptClientDiagnostics.CreateScope("DeploymentScript.Get"); scope.Start(); try { var response = _deploymentScriptRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); if (response.Value == null) { throw _deploymentScriptClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new DeploymentScript(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <DeploymentScript> Get(string scriptName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(scriptName, nameof(scriptName)); using var scope = _deploymentScriptClientDiagnostics.CreateScope("DeploymentScriptCollection.Get"); scope.Start(); try { var response = _deploymentScriptRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, scriptName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new DeploymentScript(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <DeploymentScript> Get(string scriptName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("DeploymentScriptContainer.Get"); scope.Start(); try { if (scriptName == null) { throw new ArgumentNullException(nameof(scriptName)); } var response = _restClient.Get(Id.ResourceGroupName, scriptName, cancellationToken: cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new DeploymentScript(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }