private Amazon.Backup.Model.UpdateRecoveryPointLifecycleResponse CallAWSServiceOperation(IAmazonBackup client, Amazon.Backup.Model.UpdateRecoveryPointLifecycleRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Backup", "UpdateRecoveryPointLifecycle"); try { #if DESKTOP return(client.UpdateRecoveryPointLifecycle(request)); #elif CORECLR return(client.UpdateRecoveryPointLifecycleAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Backup.Model.UpdateRecoveryPointLifecycleRequest(); if (cmdletContext.BackupVaultName != null) { request.BackupVaultName = cmdletContext.BackupVaultName; } // populate Lifecycle var requestLifecycleIsNull = true; request.Lifecycle = new Amazon.Backup.Model.Lifecycle(); System.Int64?requestLifecycle_lifecycle_DeleteAfterDay = null; if (cmdletContext.Lifecycle_DeleteAfterDay != null) { requestLifecycle_lifecycle_DeleteAfterDay = cmdletContext.Lifecycle_DeleteAfterDay.Value; } if (requestLifecycle_lifecycle_DeleteAfterDay != null) { request.Lifecycle.DeleteAfterDays = requestLifecycle_lifecycle_DeleteAfterDay.Value; requestLifecycleIsNull = false; } System.Int64?requestLifecycle_lifecycle_MoveToColdStorageAfterDay = null; if (cmdletContext.Lifecycle_MoveToColdStorageAfterDay != null) { requestLifecycle_lifecycle_MoveToColdStorageAfterDay = cmdletContext.Lifecycle_MoveToColdStorageAfterDay.Value; } if (requestLifecycle_lifecycle_MoveToColdStorageAfterDay != null) { request.Lifecycle.MoveToColdStorageAfterDays = requestLifecycle_lifecycle_MoveToColdStorageAfterDay.Value; requestLifecycleIsNull = false; } // determine if request.Lifecycle should be set to null if (requestLifecycleIsNull) { request.Lifecycle = null; } if (cmdletContext.RecoveryPointArn != null) { request.RecoveryPointArn = cmdletContext.RecoveryPointArn; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }