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