private Amazon.DocDB.Model.RestoreDBClusterFromSnapshotResponse CallAWSServiceOperation(IAmazonDocDB client, Amazon.DocDB.Model.RestoreDBClusterFromSnapshotRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon DocumentDB (with MongoDB compatibility)", "RestoreDBClusterFromSnapshot"); try { #if DESKTOP return(client.RestoreDBClusterFromSnapshot(request)); #elif CORECLR return(client.RestoreDBClusterFromSnapshotAsync(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.DocDB.Model.RestoreDBClusterFromSnapshotRequest(); if (cmdletContext.AvailabilityZone != null) { request.AvailabilityZones = cmdletContext.AvailabilityZone; } if (cmdletContext.DBClusterIdentifier != null) { request.DBClusterIdentifier = cmdletContext.DBClusterIdentifier; } if (cmdletContext.DBSubnetGroupName != null) { request.DBSubnetGroupName = cmdletContext.DBSubnetGroupName; } if (cmdletContext.DeletionProtection != null) { request.DeletionProtection = cmdletContext.DeletionProtection.Value; } if (cmdletContext.EnableCloudwatchLogsExport != null) { request.EnableCloudwatchLogsExports = cmdletContext.EnableCloudwatchLogsExport; } if (cmdletContext.Engine != null) { request.Engine = cmdletContext.Engine; } if (cmdletContext.EngineVersion != null) { request.EngineVersion = cmdletContext.EngineVersion; } if (cmdletContext.KmsKeyId != null) { request.KmsKeyId = cmdletContext.KmsKeyId; } if (cmdletContext.Port != null) { request.Port = cmdletContext.Port.Value; } if (cmdletContext.SnapshotIdentifier != null) { request.SnapshotIdentifier = cmdletContext.SnapshotIdentifier; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } if (cmdletContext.VpcSecurityGroupId != null) { request.VpcSecurityGroupIds = cmdletContext.VpcSecurityGroupId; } 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); }