private void TriggerInquiry(string vaultName, string vaultResourceGroupName, string storageContainerName) { ODataQuery <BMSContainersInquiryQueryObject> queryParams = new ODataQuery <BMSContainersInquiryQueryObject>( q => q.WorkloadType == ServiceClientModel.WorkloadType.AzureFileShare); string errorMessage = string.Empty; var inquiryResponse = ServiceClientAdapter.InquireContainer( storageContainerName, queryParams, vaultName, vaultResourceGroupName); var operationStatus = TrackingHelpers.GetOperationResult( inquiryResponse, operationId => ServiceClientAdapter.GetContainerRefreshOrInquiryOperationResult( operationId, vaultName: vaultName, resourceGroupName: vaultResourceGroupName)); //Now wait for the operation to Complete if (inquiryResponse.Response.StatusCode != SystemNet.HttpStatusCode.NoContent) { errorMessage = string.Format(Resources.TriggerEnquiryFailureErrorCode, inquiryResponse.Response.StatusCode); Logger.Instance.WriteDebug(errorMessage); } }
public override void ExecuteCmdlet() { ExecutionBlock(() => { base.ExecuteCmdlet(); ResourceIdentifier resourceIdentifier = new ResourceIdentifier(VaultId); string vaultName = resourceIdentifier.ResourceName; string vaultResourceGroupName = resourceIdentifier.ResourceGroupName; string workloadType = ConversionUtils.GetServiceClientWorkloadType(WorkloadType.ToString()); string backupManagementType = Container.BackupManagementType.ToString(); ODataQuery <BMSContainersInquiryQueryObject> queryParams = new ODataQuery <BMSContainersInquiryQueryObject>( q => q.WorkloadType == workloadType && q.BackupManagementType == backupManagementType); string errorMessage = string.Empty; var inquiryResponse = ServiceClientAdapter.InquireContainer( Container.Name, queryParams, vaultName, vaultResourceGroupName); var operationStatus = TrackingHelpers.GetOperationResult( inquiryResponse, operationId => ServiceClientAdapter.GetRegisterContainerOperationResult( operationId, Container.Name, vaultName: vaultName, resourceGroupName: vaultResourceGroupName)); if (inquiryResponse.Response.StatusCode == SystemNet.HttpStatusCode.OK) { Logger.Instance.WriteDebug(errorMessage); } //Now wait for the operation to Complete if (inquiryResponse.Response.StatusCode != SystemNet.HttpStatusCode.NoContent) { errorMessage = string.Format(Resources.TriggerEnquiryFailureErrorCode, inquiryResponse.Response.StatusCode); Logger.Instance.WriteDebug(errorMessage); } if (PassThru.IsPresent) { WriteObject(Container); } }, ShouldProcess(Container.Name, VerbsLifecycle.Invoke)); }