private Amazon.Macie2.Model.CreateClassificationJobResponse CallAWSServiceOperation(IAmazonMacie2 client, Amazon.Macie2.Model.CreateClassificationJobRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Macie 2", "CreateClassificationJob"); try { #if DESKTOP return(client.CreateClassificationJob(request)); #elif CORECLR return(client.CreateClassificationJobAsync(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.Macie2.Model.CreateClassificationJobRequest(); if (cmdletContext.ClientToken != null) { request.ClientToken = cmdletContext.ClientToken; } if (cmdletContext.CustomDataIdentifierId != null) { request.CustomDataIdentifierIds = cmdletContext.CustomDataIdentifierId; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.InitialRun != null) { request.InitialRun = cmdletContext.InitialRun.Value; } if (cmdletContext.JobType != null) { request.JobType = cmdletContext.JobType; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } // populate S3JobDefinition var requestS3JobDefinitionIsNull = true; request.S3JobDefinition = new Amazon.Macie2.Model.S3JobDefinition(); List <Amazon.Macie2.Model.S3BucketDefinitionForJob> requestS3JobDefinition_s3JobDefinition_BucketDefinition = null; if (cmdletContext.S3JobDefinition_BucketDefinition != null) { requestS3JobDefinition_s3JobDefinition_BucketDefinition = cmdletContext.S3JobDefinition_BucketDefinition; } if (requestS3JobDefinition_s3JobDefinition_BucketDefinition != null) { request.S3JobDefinition.BucketDefinitions = requestS3JobDefinition_s3JobDefinition_BucketDefinition; requestS3JobDefinitionIsNull = false; } Amazon.Macie2.Model.Scoping requestS3JobDefinition_s3JobDefinition_Scoping = null; // populate Scoping var requestS3JobDefinition_s3JobDefinition_ScopingIsNull = true; requestS3JobDefinition_s3JobDefinition_Scoping = new Amazon.Macie2.Model.Scoping(); Amazon.Macie2.Model.JobScopingBlock requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Excludes = null; // populate Excludes var requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_ExcludesIsNull = true; requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Excludes = new Amazon.Macie2.Model.JobScopingBlock(); List <Amazon.Macie2.Model.JobScopeTerm> requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Excludes_excludes_And = null; if (cmdletContext.Excludes_And != null) { requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Excludes_excludes_And = cmdletContext.Excludes_And; } if (requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Excludes_excludes_And != null) { requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Excludes.And = requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Excludes_excludes_And; requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_ExcludesIsNull = false; } // determine if requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Excludes should be set to null if (requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_ExcludesIsNull) { requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Excludes = null; } if (requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Excludes != null) { requestS3JobDefinition_s3JobDefinition_Scoping.Excludes = requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Excludes; requestS3JobDefinition_s3JobDefinition_ScopingIsNull = false; } Amazon.Macie2.Model.JobScopingBlock requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Includes = null; // populate Includes var requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_IncludesIsNull = true; requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Includes = new Amazon.Macie2.Model.JobScopingBlock(); List <Amazon.Macie2.Model.JobScopeTerm> requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Includes_includes_And = null; if (cmdletContext.Includes_And != null) { requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Includes_includes_And = cmdletContext.Includes_And; } if (requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Includes_includes_And != null) { requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Includes.And = requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Includes_includes_And; requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_IncludesIsNull = false; } // determine if requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Includes should be set to null if (requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_IncludesIsNull) { requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Includes = null; } if (requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Includes != null) { requestS3JobDefinition_s3JobDefinition_Scoping.Includes = requestS3JobDefinition_s3JobDefinition_Scoping_s3JobDefinition_Scoping_Includes; requestS3JobDefinition_s3JobDefinition_ScopingIsNull = false; } // determine if requestS3JobDefinition_s3JobDefinition_Scoping should be set to null if (requestS3JobDefinition_s3JobDefinition_ScopingIsNull) { requestS3JobDefinition_s3JobDefinition_Scoping = null; } if (requestS3JobDefinition_s3JobDefinition_Scoping != null) { request.S3JobDefinition.Scoping = requestS3JobDefinition_s3JobDefinition_Scoping; requestS3JobDefinitionIsNull = false; } // determine if request.S3JobDefinition should be set to null if (requestS3JobDefinitionIsNull) { request.S3JobDefinition = null; } if (cmdletContext.SamplingPercentage != null) { request.SamplingPercentage = cmdletContext.SamplingPercentage.Value; } // populate ScheduleFrequency var requestScheduleFrequencyIsNull = true; request.ScheduleFrequency = new Amazon.Macie2.Model.JobScheduleFrequency(); Amazon.Macie2.Model.DailySchedule requestScheduleFrequency_scheduleFrequency_DailySchedule = null; if (cmdletContext.ScheduleFrequency_DailySchedule != null) { requestScheduleFrequency_scheduleFrequency_DailySchedule = cmdletContext.ScheduleFrequency_DailySchedule; } if (requestScheduleFrequency_scheduleFrequency_DailySchedule != null) { request.ScheduleFrequency.DailySchedule = requestScheduleFrequency_scheduleFrequency_DailySchedule; requestScheduleFrequencyIsNull = false; } Amazon.Macie2.Model.MonthlySchedule requestScheduleFrequency_scheduleFrequency_MonthlySchedule = null; // populate MonthlySchedule var requestScheduleFrequency_scheduleFrequency_MonthlyScheduleIsNull = true; requestScheduleFrequency_scheduleFrequency_MonthlySchedule = new Amazon.Macie2.Model.MonthlySchedule(); System.Int32?requestScheduleFrequency_scheduleFrequency_MonthlySchedule_monthlySchedule_DayOfMonth = null; if (cmdletContext.MonthlySchedule_DayOfMonth != null) { requestScheduleFrequency_scheduleFrequency_MonthlySchedule_monthlySchedule_DayOfMonth = cmdletContext.MonthlySchedule_DayOfMonth.Value; } if (requestScheduleFrequency_scheduleFrequency_MonthlySchedule_monthlySchedule_DayOfMonth != null) { requestScheduleFrequency_scheduleFrequency_MonthlySchedule.DayOfMonth = requestScheduleFrequency_scheduleFrequency_MonthlySchedule_monthlySchedule_DayOfMonth.Value; requestScheduleFrequency_scheduleFrequency_MonthlyScheduleIsNull = false; } // determine if requestScheduleFrequency_scheduleFrequency_MonthlySchedule should be set to null if (requestScheduleFrequency_scheduleFrequency_MonthlyScheduleIsNull) { requestScheduleFrequency_scheduleFrequency_MonthlySchedule = null; } if (requestScheduleFrequency_scheduleFrequency_MonthlySchedule != null) { request.ScheduleFrequency.MonthlySchedule = requestScheduleFrequency_scheduleFrequency_MonthlySchedule; requestScheduleFrequencyIsNull = false; } Amazon.Macie2.Model.WeeklySchedule requestScheduleFrequency_scheduleFrequency_WeeklySchedule = null; // populate WeeklySchedule var requestScheduleFrequency_scheduleFrequency_WeeklyScheduleIsNull = true; requestScheduleFrequency_scheduleFrequency_WeeklySchedule = new Amazon.Macie2.Model.WeeklySchedule(); Amazon.Macie2.DayOfWeek requestScheduleFrequency_scheduleFrequency_WeeklySchedule_weeklySchedule_DayOfWeek = null; if (cmdletContext.WeeklySchedule_DayOfWeek != null) { requestScheduleFrequency_scheduleFrequency_WeeklySchedule_weeklySchedule_DayOfWeek = cmdletContext.WeeklySchedule_DayOfWeek; } if (requestScheduleFrequency_scheduleFrequency_WeeklySchedule_weeklySchedule_DayOfWeek != null) { requestScheduleFrequency_scheduleFrequency_WeeklySchedule.DayOfWeek = requestScheduleFrequency_scheduleFrequency_WeeklySchedule_weeklySchedule_DayOfWeek; requestScheduleFrequency_scheduleFrequency_WeeklyScheduleIsNull = false; } // determine if requestScheduleFrequency_scheduleFrequency_WeeklySchedule should be set to null if (requestScheduleFrequency_scheduleFrequency_WeeklyScheduleIsNull) { requestScheduleFrequency_scheduleFrequency_WeeklySchedule = null; } if (requestScheduleFrequency_scheduleFrequency_WeeklySchedule != null) { request.ScheduleFrequency.WeeklySchedule = requestScheduleFrequency_scheduleFrequency_WeeklySchedule; requestScheduleFrequencyIsNull = false; } // determine if request.ScheduleFrequency should be set to null if (requestScheduleFrequencyIsNull) { request.ScheduleFrequency = null; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } 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); }