private Amazon.DocDB.Model.ModifyDBInstanceResponse CallAWSServiceOperation(IAmazonDocDB client, Amazon.DocDB.Model.ModifyDBInstanceRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon DocumentDB (with MongoDB compatibility)", "ModifyDBInstance"); try { #if DESKTOP return client.ModifyDBInstance(request); #elif CORECLR return client.ModifyDBInstanceAsync(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.ModifyDBInstanceRequest(); if (cmdletContext.ApplyImmediately != null) { request.ApplyImmediately = cmdletContext.ApplyImmediately.Value; } if (cmdletContext.AutoMinorVersionUpgrade != null) { request.AutoMinorVersionUpgrade = cmdletContext.AutoMinorVersionUpgrade.Value; } if (cmdletContext.CACertificateIdentifier != null) { request.CACertificateIdentifier = cmdletContext.CACertificateIdentifier; } if (cmdletContext.DBInstanceClass != null) { request.DBInstanceClass = cmdletContext.DBInstanceClass; } if (cmdletContext.DBInstanceIdentifier != null) { request.DBInstanceIdentifier = cmdletContext.DBInstanceIdentifier; } if (cmdletContext.NewDBInstanceIdentifier != null) { request.NewDBInstanceIdentifier = cmdletContext.NewDBInstanceIdentifier; } if (cmdletContext.PreferredMaintenanceWindow != null) { request.PreferredMaintenanceWindow = cmdletContext.PreferredMaintenanceWindow; } if (cmdletContext.PromotionTier != null) { request.PromotionTier = cmdletContext.PromotionTier.Value; } 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; }