public virtual TemplateSpecVersionCreateOrUpdateOperation CreateOrUpdate(string templateSpecVersion, TemplateSpecVersionData templateSpecVersionModel, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (templateSpecVersion == null) { throw new ArgumentNullException(nameof(templateSpecVersion)); } if (templateSpecVersionModel == null) { throw new ArgumentNullException(nameof(templateSpecVersionModel)); } using var scope = _clientDiagnostics.CreateScope("TemplateSpecVersionCollection.CreateOrUpdate"); scope.Start(); try { var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Name, templateSpecVersion, templateSpecVersionModel, cancellationToken); var operation = new TemplateSpecVersionCreateOrUpdateOperation(Parent, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <TemplateSpecVersion> CreateOrUpdate(WaitUntil waitUntil, string templateSpecVersion, TemplateSpecVersionData templateSpecVersionModel, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(templateSpecVersion, nameof(templateSpecVersion)); Argument.AssertNotNull(templateSpecVersionModel, nameof(templateSpecVersionModel)); using var scope = _templateSpecVersionClientDiagnostics.CreateScope("TemplateSpecVersionCollection.CreateOrUpdate"); scope.Start(); try { var response = _templateSpecVersionRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, templateSpecVersion, templateSpecVersionModel, cancellationToken); var operation = new ResourcesArmOperation <TemplateSpecVersion>(Response.FromValue(new TemplateSpecVersion(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }