Exemple #1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.TranscribeService.Model.StartTranscriptionJobRequest();


            // populate ContentRedaction
            var requestContentRedactionIsNull = true;

            request.ContentRedaction = new Amazon.TranscribeService.Model.ContentRedaction();
            Amazon.TranscribeService.RedactionOutput requestContentRedaction_contentRedaction_RedactionOutput = null;
            if (cmdletContext.ContentRedaction_RedactionOutput != null)
            {
                requestContentRedaction_contentRedaction_RedactionOutput = cmdletContext.ContentRedaction_RedactionOutput;
            }
            if (requestContentRedaction_contentRedaction_RedactionOutput != null)
            {
                request.ContentRedaction.RedactionOutput = requestContentRedaction_contentRedaction_RedactionOutput;
                requestContentRedactionIsNull            = false;
            }
            Amazon.TranscribeService.RedactionType requestContentRedaction_contentRedaction_RedactionType = null;
            if (cmdletContext.ContentRedaction_RedactionType != null)
            {
                requestContentRedaction_contentRedaction_RedactionType = cmdletContext.ContentRedaction_RedactionType;
            }
            if (requestContentRedaction_contentRedaction_RedactionType != null)
            {
                request.ContentRedaction.RedactionType = requestContentRedaction_contentRedaction_RedactionType;
                requestContentRedactionIsNull          = false;
            }
            // determine if request.ContentRedaction should be set to null
            if (requestContentRedactionIsNull)
            {
                request.ContentRedaction = null;
            }

            // populate JobExecutionSettings
            var requestJobExecutionSettingsIsNull = true;

            request.JobExecutionSettings = new Amazon.TranscribeService.Model.JobExecutionSettings();
            System.Boolean?requestJobExecutionSettings_jobExecutionSettings_AllowDeferredExecution = null;
            if (cmdletContext.JobExecutionSettings_AllowDeferredExecution != null)
            {
                requestJobExecutionSettings_jobExecutionSettings_AllowDeferredExecution = cmdletContext.JobExecutionSettings_AllowDeferredExecution.Value;
            }
            if (requestJobExecutionSettings_jobExecutionSettings_AllowDeferredExecution != null)
            {
                request.JobExecutionSettings.AllowDeferredExecution = requestJobExecutionSettings_jobExecutionSettings_AllowDeferredExecution.Value;
                requestJobExecutionSettingsIsNull = false;
            }
            System.String requestJobExecutionSettings_jobExecutionSettings_DataAccessRoleArn = null;
            if (cmdletContext.JobExecutionSettings_DataAccessRoleArn != null)
            {
                requestJobExecutionSettings_jobExecutionSettings_DataAccessRoleArn = cmdletContext.JobExecutionSettings_DataAccessRoleArn;
            }
            if (requestJobExecutionSettings_jobExecutionSettings_DataAccessRoleArn != null)
            {
                request.JobExecutionSettings.DataAccessRoleArn = requestJobExecutionSettings_jobExecutionSettings_DataAccessRoleArn;
                requestJobExecutionSettingsIsNull = false;
            }
            // determine if request.JobExecutionSettings should be set to null
            if (requestJobExecutionSettingsIsNull)
            {
                request.JobExecutionSettings = null;
            }
            if (cmdletContext.LanguageCode != null)
            {
                request.LanguageCode = cmdletContext.LanguageCode;
            }

            // populate Media
            var requestMediaIsNull = true;

            request.Media = new Amazon.TranscribeService.Model.Media();
            System.String requestMedia_media_MediaFileUri = null;
            if (cmdletContext.Media_MediaFileUri != null)
            {
                requestMedia_media_MediaFileUri = cmdletContext.Media_MediaFileUri;
            }
            if (requestMedia_media_MediaFileUri != null)
            {
                request.Media.MediaFileUri = requestMedia_media_MediaFileUri;
                requestMediaIsNull         = false;
            }
            // determine if request.Media should be set to null
            if (requestMediaIsNull)
            {
                request.Media = null;
            }
            if (cmdletContext.MediaFormat != null)
            {
                request.MediaFormat = cmdletContext.MediaFormat;
            }
            if (cmdletContext.MediaSampleRateHertz != null)
            {
                request.MediaSampleRateHertz = cmdletContext.MediaSampleRateHertz.Value;
            }
            if (cmdletContext.OutputBucketName != null)
            {
                request.OutputBucketName = cmdletContext.OutputBucketName;
            }
            if (cmdletContext.OutputEncryptionKMSKeyId != null)
            {
                request.OutputEncryptionKMSKeyId = cmdletContext.OutputEncryptionKMSKeyId;
            }

            // populate Settings
            var requestSettingsIsNull = true;

            request.Settings = new Amazon.TranscribeService.Model.Settings();
            System.Boolean?requestSettings_settings_ChannelIdentification = null;
            if (cmdletContext.Settings_ChannelIdentification != null)
            {
                requestSettings_settings_ChannelIdentification = cmdletContext.Settings_ChannelIdentification.Value;
            }
            if (requestSettings_settings_ChannelIdentification != null)
            {
                request.Settings.ChannelIdentification = requestSettings_settings_ChannelIdentification.Value;
                requestSettingsIsNull = false;
            }
            System.Int32?requestSettings_settings_MaxAlternative = null;
            if (cmdletContext.Settings_MaxAlternative != null)
            {
                requestSettings_settings_MaxAlternative = cmdletContext.Settings_MaxAlternative.Value;
            }
            if (requestSettings_settings_MaxAlternative != null)
            {
                request.Settings.MaxAlternatives = requestSettings_settings_MaxAlternative.Value;
                requestSettingsIsNull            = false;
            }
            System.Int32?requestSettings_settings_MaxSpeakerLabel = null;
            if (cmdletContext.Settings_MaxSpeakerLabel != null)
            {
                requestSettings_settings_MaxSpeakerLabel = cmdletContext.Settings_MaxSpeakerLabel.Value;
            }
            if (requestSettings_settings_MaxSpeakerLabel != null)
            {
                request.Settings.MaxSpeakerLabels = requestSettings_settings_MaxSpeakerLabel.Value;
                requestSettingsIsNull             = false;
            }
            System.Boolean?requestSettings_settings_ShowAlternative = null;
            if (cmdletContext.Settings_ShowAlternative != null)
            {
                requestSettings_settings_ShowAlternative = cmdletContext.Settings_ShowAlternative.Value;
            }
            if (requestSettings_settings_ShowAlternative != null)
            {
                request.Settings.ShowAlternatives = requestSettings_settings_ShowAlternative.Value;
                requestSettingsIsNull             = false;
            }
            System.Boolean?requestSettings_settings_ShowSpeakerLabel = null;
            if (cmdletContext.Settings_ShowSpeakerLabel != null)
            {
                requestSettings_settings_ShowSpeakerLabel = cmdletContext.Settings_ShowSpeakerLabel.Value;
            }
            if (requestSettings_settings_ShowSpeakerLabel != null)
            {
                request.Settings.ShowSpeakerLabels = requestSettings_settings_ShowSpeakerLabel.Value;
                requestSettingsIsNull = false;
            }
            Amazon.TranscribeService.VocabularyFilterMethod requestSettings_settings_VocabularyFilterMethod = null;
            if (cmdletContext.Settings_VocabularyFilterMethod != null)
            {
                requestSettings_settings_VocabularyFilterMethod = cmdletContext.Settings_VocabularyFilterMethod;
            }
            if (requestSettings_settings_VocabularyFilterMethod != null)
            {
                request.Settings.VocabularyFilterMethod = requestSettings_settings_VocabularyFilterMethod;
                requestSettingsIsNull = false;
            }
            System.String requestSettings_settings_VocabularyFilterName = null;
            if (cmdletContext.Settings_VocabularyFilterName != null)
            {
                requestSettings_settings_VocabularyFilterName = cmdletContext.Settings_VocabularyFilterName;
            }
            if (requestSettings_settings_VocabularyFilterName != null)
            {
                request.Settings.VocabularyFilterName = requestSettings_settings_VocabularyFilterName;
                requestSettingsIsNull = false;
            }
            System.String requestSettings_settings_VocabularyName = null;
            if (cmdletContext.Settings_VocabularyName != null)
            {
                requestSettings_settings_VocabularyName = cmdletContext.Settings_VocabularyName;
            }
            if (requestSettings_settings_VocabularyName != null)
            {
                request.Settings.VocabularyName = requestSettings_settings_VocabularyName;
                requestSettingsIsNull           = false;
            }
            // determine if request.Settings should be set to null
            if (requestSettingsIsNull)
            {
                request.Settings = null;
            }
            if (cmdletContext.TranscriptionJobName != null)
            {
                request.TranscriptionJobName = cmdletContext.TranscriptionJobName;
            }

            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);
        }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.TranscribeService.Model.StartCallAnalyticsJobRequest();

            if (cmdletContext.CallAnalyticsJobName != null)
            {
                request.CallAnalyticsJobName = cmdletContext.CallAnalyticsJobName;
            }
            if (cmdletContext.ChannelDefinition != null)
            {
                request.ChannelDefinitions = cmdletContext.ChannelDefinition;
            }
            if (cmdletContext.DataAccessRoleArn != null)
            {
                request.DataAccessRoleArn = cmdletContext.DataAccessRoleArn;
            }

            // populate Media
            var requestMediaIsNull = true;

            request.Media = new Amazon.TranscribeService.Model.Media();
            System.String requestMedia_media_MediaFileUri = null;
            if (cmdletContext.Media_MediaFileUri != null)
            {
                requestMedia_media_MediaFileUri = cmdletContext.Media_MediaFileUri;
            }
            if (requestMedia_media_MediaFileUri != null)
            {
                request.Media.MediaFileUri = requestMedia_media_MediaFileUri;
                requestMediaIsNull         = false;
            }
            System.String requestMedia_media_RedactedMediaFileUri = null;
            if (cmdletContext.Media_RedactedMediaFileUri != null)
            {
                requestMedia_media_RedactedMediaFileUri = cmdletContext.Media_RedactedMediaFileUri;
            }
            if (requestMedia_media_RedactedMediaFileUri != null)
            {
                request.Media.RedactedMediaFileUri = requestMedia_media_RedactedMediaFileUri;
                requestMediaIsNull = false;
            }
            // determine if request.Media should be set to null
            if (requestMediaIsNull)
            {
                request.Media = null;
            }
            if (cmdletContext.OutputEncryptionKMSKeyId != null)
            {
                request.OutputEncryptionKMSKeyId = cmdletContext.OutputEncryptionKMSKeyId;
            }
            if (cmdletContext.OutputLocation != null)
            {
                request.OutputLocation = cmdletContext.OutputLocation;
            }

            // populate Settings
            var requestSettingsIsNull = true;

            request.Settings = new Amazon.TranscribeService.Model.CallAnalyticsJobSettings();
            Dictionary <System.String, Amazon.TranscribeService.Model.LanguageIdSettings> requestSettings_settings_LanguageIdSetting = null;

            if (cmdletContext.Settings_LanguageIdSetting != null)
            {
                requestSettings_settings_LanguageIdSetting = cmdletContext.Settings_LanguageIdSetting;
            }
            if (requestSettings_settings_LanguageIdSetting != null)
            {
                request.Settings.LanguageIdSettings = requestSettings_settings_LanguageIdSetting;
                requestSettingsIsNull = false;
            }
            System.String requestSettings_settings_LanguageModelName = null;
            if (cmdletContext.Settings_LanguageModelName != null)
            {
                requestSettings_settings_LanguageModelName = cmdletContext.Settings_LanguageModelName;
            }
            if (requestSettings_settings_LanguageModelName != null)
            {
                request.Settings.LanguageModelName = requestSettings_settings_LanguageModelName;
                requestSettingsIsNull = false;
            }
            List <System.String> requestSettings_settings_LanguageOption = null;

            if (cmdletContext.Settings_LanguageOption != null)
            {
                requestSettings_settings_LanguageOption = cmdletContext.Settings_LanguageOption;
            }
            if (requestSettings_settings_LanguageOption != null)
            {
                request.Settings.LanguageOptions = requestSettings_settings_LanguageOption;
                requestSettingsIsNull            = false;
            }
            Amazon.TranscribeService.VocabularyFilterMethod requestSettings_settings_VocabularyFilterMethod = null;
            if (cmdletContext.Settings_VocabularyFilterMethod != null)
            {
                requestSettings_settings_VocabularyFilterMethod = cmdletContext.Settings_VocabularyFilterMethod;
            }
            if (requestSettings_settings_VocabularyFilterMethod != null)
            {
                request.Settings.VocabularyFilterMethod = requestSettings_settings_VocabularyFilterMethod;
                requestSettingsIsNull = false;
            }
            System.String requestSettings_settings_VocabularyFilterName = null;
            if (cmdletContext.Settings_VocabularyFilterName != null)
            {
                requestSettings_settings_VocabularyFilterName = cmdletContext.Settings_VocabularyFilterName;
            }
            if (requestSettings_settings_VocabularyFilterName != null)
            {
                request.Settings.VocabularyFilterName = requestSettings_settings_VocabularyFilterName;
                requestSettingsIsNull = false;
            }
            System.String requestSettings_settings_VocabularyName = null;
            if (cmdletContext.Settings_VocabularyName != null)
            {
                requestSettings_settings_VocabularyName = cmdletContext.Settings_VocabularyName;
            }
            if (requestSettings_settings_VocabularyName != null)
            {
                request.Settings.VocabularyName = requestSettings_settings_VocabularyName;
                requestSettingsIsNull           = false;
            }
            Amazon.TranscribeService.Model.ContentRedaction requestSettings_settings_ContentRedaction = null;

            // populate ContentRedaction
            var requestSettings_settings_ContentRedactionIsNull = true;

            requestSettings_settings_ContentRedaction = new Amazon.TranscribeService.Model.ContentRedaction();
            Amazon.TranscribeService.RedactionOutput requestSettings_settings_ContentRedaction_contentRedaction_RedactionOutput = null;
            if (cmdletContext.ContentRedaction_RedactionOutput != null)
            {
                requestSettings_settings_ContentRedaction_contentRedaction_RedactionOutput = cmdletContext.ContentRedaction_RedactionOutput;
            }
            if (requestSettings_settings_ContentRedaction_contentRedaction_RedactionOutput != null)
            {
                requestSettings_settings_ContentRedaction.RedactionOutput = requestSettings_settings_ContentRedaction_contentRedaction_RedactionOutput;
                requestSettings_settings_ContentRedactionIsNull           = false;
            }
            Amazon.TranscribeService.RedactionType requestSettings_settings_ContentRedaction_contentRedaction_RedactionType = null;
            if (cmdletContext.ContentRedaction_RedactionType != null)
            {
                requestSettings_settings_ContentRedaction_contentRedaction_RedactionType = cmdletContext.ContentRedaction_RedactionType;
            }
            if (requestSettings_settings_ContentRedaction_contentRedaction_RedactionType != null)
            {
                requestSettings_settings_ContentRedaction.RedactionType = requestSettings_settings_ContentRedaction_contentRedaction_RedactionType;
                requestSettings_settings_ContentRedactionIsNull         = false;
            }
            // determine if requestSettings_settings_ContentRedaction should be set to null
            if (requestSettings_settings_ContentRedactionIsNull)
            {
                requestSettings_settings_ContentRedaction = null;
            }
            if (requestSettings_settings_ContentRedaction != null)
            {
                request.Settings.ContentRedaction = requestSettings_settings_ContentRedaction;
                requestSettingsIsNull             = false;
            }
            // determine if request.Settings should be set to null
            if (requestSettingsIsNull)
            {
                request.Settings = null;
            }

            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);
        }