public virtual ArmOperation <WhatIfOperationResult> WhatIf(bool waitForCompletion, string location, DeploymentWhatIfProperties properties, CancellationToken cancellationToken = default) { Argument.AssertNotNull(location, nameof(location)); Argument.AssertNotNull(properties, nameof(properties)); using var scope = _deploymentClientDiagnostics.CreateScope("Deployment.WhatIf"); scope.Start(); try { if (Id.Parent.ResourceType == Tenant.ResourceType) { var response = _deploymentRestClient.WhatIfAtTenantScope(Id.Name, location, properties, cancellationToken); var operation = new ResourcesArmOperation <WhatIfOperationResult>(new WhatIfOperationResultOperationSource(), _deploymentClientDiagnostics, Pipeline, _deploymentRestClient.CreateWhatIfAtTenantScopeRequest(Id.Name, location, properties).Request, response, OperationFinalStateVia.Location); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } else if (Id.Parent.ResourceType == ManagementGroup.ResourceType) { var response = _deploymentRestClient.WhatIfAtManagementGroupScope(Id.Parent.Name, Id.Name, location, properties, cancellationToken); var operation = new ResourcesArmOperation <WhatIfOperationResult>(new WhatIfOperationResultOperationSource(), _deploymentClientDiagnostics, Pipeline, _deploymentRestClient.CreateWhatIfAtManagementGroupScopeRequest(Id.Parent.Name, Id.Name, location, properties).Request, response, OperationFinalStateVia.Location); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } else if (Id.Parent.ResourceType == Subscription.ResourceType) { var response = _deploymentRestClient.WhatIfAtSubscriptionScope(Id.SubscriptionId, Id.Name, properties, location, cancellationToken); var operation = new ResourcesArmOperation <WhatIfOperationResult>(new WhatIfOperationResultOperationSource(), _deploymentClientDiagnostics, Pipeline, _deploymentRestClient.CreateWhatIfAtSubscriptionScopeRequest(Id.SubscriptionId, Id.Name, properties, location).Request, response, OperationFinalStateVia.Location); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } else if (Id.Parent.ResourceType == ResourceGroup.ResourceType) { var response = _deploymentRestClient.WhatIf(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, properties, location, cancellationToken); var operation = new ResourcesArmOperation <WhatIfOperationResult>(new WhatIfOperationResultOperationSource(), _deploymentClientDiagnostics, Pipeline, _deploymentRestClient.CreateWhatIfRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, properties, location).Request, response, OperationFinalStateVia.Location); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } else { throw new InvalidOperationException($"{Id.Parent.ResourceType} is not supported here"); } } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <ArmOperation <GenericResource> > CreateOrUpdateAsync(WaitUntil waitUntil, ResourceIdentifier resourceId, GenericResourceData parameters, CancellationToken cancellationToken = default) { if (resourceId == null) { throw new ArgumentNullException(nameof(resourceId)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("GenericResourceCollection.CreateOrUpdate"); scope.Start(); try { var apiVersion = await GetApiVersionAsync(new ResourceIdentifier(resourceId), cancellationToken).ConfigureAwait(false); var response = await _resourcesRestClient.CreateOrUpdateByIdAsync(resourceId, apiVersion, parameters, cancellationToken).ConfigureAwait(false); var operation = new ResourcesArmOperation <GenericResource>(new GenericResourceOperationSource(Client), _clientDiagnostics, Pipeline, _resourcesRestClient.CreateCreateOrUpdateByIdRequest(resourceId, apiVersion, parameters).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <GenericResource> Update(bool waitForCompletion, GenericResourceData parameters, CancellationToken cancellationToken = default) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("GenericResource.Update"); scope.Start(); try { var apiVersion = GetApiVersion(cancellationToken); var response = _resourcesRestClient.UpdateById(Id, apiVersion, parameters, cancellationToken); var operation = new ResourcesArmOperation <GenericResource>(new GenericResourceOperationSource(Client), _clientDiagnostics, Pipeline, _resourcesRestClient.CreateUpdateByIdRequest(Id, apiVersion, parameters).Request, response, OperationFinalStateVia.Location); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <GenericResource> CreateOrUpdate(WaitUntil waitUntil, ResourceIdentifier resourceId, GenericResourceData data, CancellationToken cancellationToken = default) { if (resourceId == null) { throw new ArgumentNullException(nameof(resourceId)); } if (data == null) { throw new ArgumentNullException(nameof(data)); } using var scope = _clientDiagnostics.CreateScope("GenericResourceCollection.CreateOrUpdate"); scope.Start(); try { var apiVersion = GetApiVersion(new ResourceIdentifier(resourceId), cancellationToken); var response = _resourcesRestClient.CreateOrUpdateById(resourceId, apiVersion, data, cancellationToken); var operation = new ResourcesArmOperation <GenericResource>(new GenericResourceOperationSource(Client), _clientDiagnostics, Pipeline, _resourcesRestClient.CreateCreateOrUpdateByIdRequest(resourceId, apiVersion, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { using var scope = _jitRequestClientDiagnostics.CreateScope("JitRequestResource.Delete"); scope.Start(); try { var response = _jitRequestRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); var operation = new ResourcesArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <PolicyAssignment> Delete(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _policyAssignmentClientDiagnostics.CreateScope("PolicyAssignment.Delete"); scope.Start(); try { var response = _policyAssignmentRestClient.Delete(Id.Parent, Id.Name, cancellationToken); var operation = new ResourcesArmOperation <PolicyAssignment>(Response.FromValue(new PolicyAssignment(Client, response), response.GetRawResponse())); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { using var scope = _deploymentClientDiagnostics.CreateScope("Deployment.Delete"); scope.Start(); try { var response = _deploymentRestClient.DeleteAtScope(Id.Parent, Id.Name, cancellationToken); var operation = new ResourcesArmOperation(_deploymentClientDiagnostics, Pipeline, _deploymentRestClient.CreateDeleteAtScopeRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletionResponse(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { using var scope = _managementGroupPolicyDefinitionPolicyDefinitionsClientDiagnostics.CreateScope("ManagementGroupPolicyDefinition.Delete"); scope.Start(); try { var response = _managementGroupPolicyDefinitionPolicyDefinitionsRestClient.DeleteAtManagementGroup(Id.Parent.Name, Id.Name, cancellationToken); var operation = new ResourcesArmOperation(response); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletionResponse(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { using var scope = _resourceLinkClientDiagnostics.CreateScope("ResourceLinkResource.Delete"); scope.Start(); try { var response = _resourceLinkRestClient.Delete(Id, cancellationToken); var operation = new ResourcesArmOperation(response); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletionResponse(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _applicationDefinitionClientDiagnostics.CreateScope("ApplicationDefinition.Delete"); scope.Start(); try { var response = _applicationDefinitionRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); var operation = new ResourcesArmOperation(_applicationDefinitionClientDiagnostics, Pipeline, _applicationDefinitionRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitForCompletion) { operation.WaitForCompletionResponse(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation Delete(WaitUntil waitUntil, string forceDeletionTypes = null, CancellationToken cancellationToken = default) { using var scope = _resourceGroupClientDiagnostics.CreateScope("ResourceGroupResource.Delete"); scope.Start(); try { var response = _resourceGroupRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, forceDeletionTypes, cancellationToken); var operation = new ResourcesArmOperation(_resourceGroupClientDiagnostics, Pipeline, _resourceGroupRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, forceDeletionTypes).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletionResponse(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _policyExemptionClientDiagnostics.CreateScope("PolicyExemption.Delete"); scope.Start(); try { var response = _policyExemptionRestClient.Delete(Id.Parent, Id.Name, cancellationToken); var operation = new ResourcesArmOperation(response); if (waitForCompletion) { operation.WaitForCompletionResponse(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _deploymentScriptClientDiagnostics.CreateScope("DeploymentScript.Delete"); scope.Start(); try { var response = _deploymentScriptRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); var operation = new ResourcesArmOperation(response); if (waitForCompletion) { operation.WaitForCompletionResponse(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation RefreshPermissions(WaitUntil waitUntil, CancellationToken cancellationToken = default) { using var scope = _armApplicationApplicationsClientDiagnostics.CreateScope("ArmApplicationResource.RefreshPermissions"); scope.Start(); try { var response = _armApplicationApplicationsRestClient.RefreshPermissions(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); var operation = new ResourcesArmOperation(_armApplicationApplicationsClientDiagnostics, Pipeline, _armApplicationApplicationsRestClient.CreateRefreshPermissionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletionResponse(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <ArmOperation <PolicyAssignmentResource> > DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { using var scope = _policyAssignmentClientDiagnostics.CreateScope("PolicyAssignmentResource.Delete"); scope.Start(); try { var response = await _policyAssignmentRestClient.DeleteAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); var operation = new ResourcesArmOperation <PolicyAssignmentResource>(Response.FromValue(new PolicyAssignmentResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <ArmOperation> DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _managementLockClientDiagnostics.CreateScope("ManagementLock.Delete"); scope.Start(); try { var response = await _managementLockRestClient.DeleteByScopeAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); var operation = new ResourcesArmOperation(response); if (waitForCompletion) { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("GenericResource.Delete"); scope.Start(); try { var apiVersion = GetApiVersion(cancellationToken); var response = _resourcesRestClient.DeleteById(Id, apiVersion, cancellationToken); var operation = new ResourcesArmOperation(_clientDiagnostics, Pipeline, _resourcesRestClient.CreateDeleteByIdRequest(Id, apiVersion).Request, response, OperationFinalStateVia.Location); if (waitForCompletion) { operation.WaitForCompletionResponse(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <ArmOperation> DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { using var scope = _armApplicationApplicationsClientDiagnostics.CreateScope("ArmApplicationResource.Delete"); scope.Start(); try { var response = await _armApplicationApplicationsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); var operation = new ResourcesArmOperation(_armApplicationApplicationsClientDiagnostics, Pipeline, _armApplicationApplicationsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <ArmOperation> DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _templateSpecVersionClientDiagnostics.CreateScope("TemplateSpecVersion.Delete"); scope.Start(); try { var response = await _templateSpecVersionRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); var operation = new ResourcesArmOperation(response); if (waitForCompletion) { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <ArmOperation> DeleteAsync(bool waitForCompletion, string forceDeletionTypes = null, CancellationToken cancellationToken = default) { using var scope = _resourceGroupClientDiagnostics.CreateScope("ResourceGroup.Delete"); scope.Start(); try { var response = await _resourceGroupRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, forceDeletionTypes, cancellationToken).ConfigureAwait(false); var operation = new ResourcesArmOperation(_resourceGroupClientDiagnostics, Pipeline, _resourceGroupRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, forceDeletionTypes).Request, response, OperationFinalStateVia.Location); if (waitForCompletion) { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <ArmOperation> DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _deploymentClientDiagnostics.CreateScope("Deployment.Delete"); scope.Start(); try { var response = await _deploymentRestClient.DeleteAtScopeAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); var operation = new ResourcesArmOperation(_deploymentClientDiagnostics, Pipeline, _deploymentRestClient.CreateDeleteAtScopeRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitForCompletion) { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <ArmOperation> DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { using var scope = _subscriptionPolicyDefinitionPolicyDefinitionsClientDiagnostics.CreateScope("SubscriptionPolicyDefinition.Delete"); scope.Start(); try { var response = await _subscriptionPolicyDefinitionPolicyDefinitionsRestClient.DeleteAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); var operation = new ResourcesArmOperation(response); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <ArmApplicationDefinitionResource> Update(WaitUntil waitUntil, ArmApplicationDefinitionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); using var scope = _armApplicationDefinitionApplicationDefinitionsClientDiagnostics.CreateScope("ArmApplicationDefinitionResource.Update"); scope.Start(); try { var response = _armApplicationDefinitionApplicationDefinitionsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken); var operation = new ResourcesArmOperation <ArmApplicationDefinitionResource>(new ArmApplicationDefinitionOperationSource(Client), _armApplicationDefinitionApplicationDefinitionsClientDiagnostics, Pipeline, _armApplicationDefinitionApplicationDefinitionsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <ResourceLink> CreateOrUpdate(bool waitForCompletion, ResourceLinkData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNull(parameters, nameof(parameters)); using var scope0 = _resourceLinkClientDiagnostics.CreateScope("ResourceLinkCollection.CreateOrUpdate"); scope0.Start(); try { var response = _resourceLinkRestClient.CreateOrUpdate(_scope, parameters, cancellationToken); var operation = new ResourcesArmOperation <ResourceLink>(Response.FromValue(new ResourceLink(Client, response), response.GetRawResponse())); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope0.Failed(e); throw; } }
public virtual ArmOperation <ResourceGroupExportResult> ExportTemplate(WaitUntil waitUntil, ExportTemplate exportTemplate, CancellationToken cancellationToken = default) { Argument.AssertNotNull(exportTemplate, nameof(exportTemplate)); using var scope = _resourceGroupClientDiagnostics.CreateScope("ResourceGroupResource.ExportTemplate"); scope.Start(); try { var response = _resourceGroupRestClient.ExportTemplate(Id.SubscriptionId, Id.ResourceGroupName, exportTemplate, cancellationToken); var operation = new ResourcesArmOperation <ResourceGroupExportResult>(new ResourceGroupExportResultOperationSource(), _resourceGroupClientDiagnostics, Pipeline, _resourceGroupRestClient.CreateExportTemplateRequest(Id.SubscriptionId, Id.ResourceGroupName, exportTemplate).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation ValidateMoveResources(WaitUntil waitUntil, ResourcesMoveInfo parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNull(parameters, nameof(parameters)); using var scope = _resourceGroupClientDiagnostics.CreateScope("ResourceGroupResource.ValidateMoveResources"); scope.Start(); try { var response = _resourceGroupRestClient.ValidateMoveResources(Id.SubscriptionId, Id.ResourceGroupName, parameters, cancellationToken); var operation = new ResourcesArmOperation(_resourceGroupClientDiagnostics, Pipeline, _resourceGroupRestClient.CreateValidateMoveResourcesRequest(Id.SubscriptionId, Id.ResourceGroupName, parameters).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletionResponse(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <ManagementLockResource> Update(WaitUntil waitUntil, ManagementLockData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); using var scope = _managementLockClientDiagnostics.CreateScope("ManagementLockResource.Update"); scope.Start(); try { var response = _managementLockRestClient.CreateOrUpdateByScope(Id.Parent, Id.Name, data, cancellationToken); var operation = new ResourcesArmOperation <ManagementLockResource>(Response.FromValue(new ManagementLockResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <TagResource> CreateOrUpdate(WaitUntil waitUntil, TagResourceData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNull(parameters, nameof(parameters)); using var scope = _tagResourceTagsClientDiagnostics.CreateScope("TagResource.CreateOrUpdate"); scope.Start(); try { var response = _tagResourceTagsRestClient.CreateOrUpdateAtScope(Id.Parent, parameters, cancellationToken); var operation = new ResourcesArmOperation <TagResource>(Response.FromValue(new TagResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <DeploymentValidateResult> Validate(bool waitForCompletion, DeploymentInput parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNull(parameters, nameof(parameters)); using var scope = _deploymentClientDiagnostics.CreateScope("Deployment.Validate"); scope.Start(); try { var response = _deploymentRestClient.ValidateAtScope(Id.Parent, Id.Name, parameters, cancellationToken); var operation = new ResourcesArmOperation <DeploymentValidateResult>(new DeploymentValidateResultOperationSource(), _deploymentClientDiagnostics, Pipeline, _deploymentRestClient.CreateValidateAtScopeRequest(Id.Parent, Id.Name, parameters).Request, response, OperationFinalStateVia.Location); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <DeploymentScript> CreateOrUpdate(bool waitForCompletion, string scriptName, DeploymentScriptData deploymentScript, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(scriptName, nameof(scriptName)); Argument.AssertNotNull(deploymentScript, nameof(deploymentScript)); using var scope = _deploymentScriptClientDiagnostics.CreateScope("DeploymentScriptCollection.CreateOrUpdate"); scope.Start(); try { var response = _deploymentScriptRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, scriptName, deploymentScript, cancellationToken); var operation = new ResourcesArmOperation <DeploymentScript>(new DeploymentScriptOperationSource(Client), _deploymentScriptClientDiagnostics, Pipeline, _deploymentScriptRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, scriptName, deploymentScript).Request, response, OperationFinalStateVia.Location); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }