Пример #1
0
 private Amazon.LexModelsV2.Model.UpdateSlotTypeResponse CallAWSServiceOperation(IAmazonLexModelsV2 client, Amazon.LexModelsV2.Model.UpdateSlotTypeRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Lex Model Building V2", "UpdateSlotType");
     try
     {
         #if DESKTOP
         return(client.UpdateSlotType(request));
         #elif CORECLR
         return(client.UpdateSlotTypeAsync(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;
     }
 }
Пример #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.LexModelsV2.Model.UpdateSlotTypeRequest();

            if (cmdletContext.BotId != null)
            {
                request.BotId = cmdletContext.BotId;
            }
            if (cmdletContext.BotVersion != null)
            {
                request.BotVersion = cmdletContext.BotVersion;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.LocaleId != null)
            {
                request.LocaleId = cmdletContext.LocaleId;
            }
            if (cmdletContext.ParentSlotTypeSignature != null)
            {
                request.ParentSlotTypeSignature = cmdletContext.ParentSlotTypeSignature;
            }
            if (cmdletContext.SlotTypeId != null)
            {
                request.SlotTypeId = cmdletContext.SlotTypeId;
            }
            if (cmdletContext.SlotTypeName != null)
            {
                request.SlotTypeName = cmdletContext.SlotTypeName;
            }
            if (cmdletContext.SlotTypeValue != null)
            {
                request.SlotTypeValues = cmdletContext.SlotTypeValue;
            }

            // populate ValueSelectionSetting
            var requestValueSelectionSettingIsNull = true;

            request.ValueSelectionSetting = new Amazon.LexModelsV2.Model.SlotValueSelectionSetting();
            Amazon.LexModelsV2.SlotValueResolutionStrategy requestValueSelectionSetting_valueSelectionSetting_ResolutionStrategy = null;
            if (cmdletContext.ValueSelectionSetting_ResolutionStrategy != null)
            {
                requestValueSelectionSetting_valueSelectionSetting_ResolutionStrategy = cmdletContext.ValueSelectionSetting_ResolutionStrategy;
            }
            if (requestValueSelectionSetting_valueSelectionSetting_ResolutionStrategy != null)
            {
                request.ValueSelectionSetting.ResolutionStrategy = requestValueSelectionSetting_valueSelectionSetting_ResolutionStrategy;
                requestValueSelectionSettingIsNull = false;
            }
            Amazon.LexModelsV2.Model.SlotValueRegexFilter requestValueSelectionSetting_valueSelectionSetting_RegexFilter = null;

            // populate RegexFilter
            var requestValueSelectionSetting_valueSelectionSetting_RegexFilterIsNull = true;

            requestValueSelectionSetting_valueSelectionSetting_RegexFilter = new Amazon.LexModelsV2.Model.SlotValueRegexFilter();
            System.String requestValueSelectionSetting_valueSelectionSetting_RegexFilter_regexFilter_Pattern = null;
            if (cmdletContext.RegexFilter_Pattern != null)
            {
                requestValueSelectionSetting_valueSelectionSetting_RegexFilter_regexFilter_Pattern = cmdletContext.RegexFilter_Pattern;
            }
            if (requestValueSelectionSetting_valueSelectionSetting_RegexFilter_regexFilter_Pattern != null)
            {
                requestValueSelectionSetting_valueSelectionSetting_RegexFilter.Pattern = requestValueSelectionSetting_valueSelectionSetting_RegexFilter_regexFilter_Pattern;
                requestValueSelectionSetting_valueSelectionSetting_RegexFilterIsNull   = false;
            }
            // determine if requestValueSelectionSetting_valueSelectionSetting_RegexFilter should be set to null
            if (requestValueSelectionSetting_valueSelectionSetting_RegexFilterIsNull)
            {
                requestValueSelectionSetting_valueSelectionSetting_RegexFilter = null;
            }
            if (requestValueSelectionSetting_valueSelectionSetting_RegexFilter != null)
            {
                request.ValueSelectionSetting.RegexFilter = requestValueSelectionSetting_valueSelectionSetting_RegexFilter;
                requestValueSelectionSettingIsNull        = false;
            }
            // determine if request.ValueSelectionSetting should be set to null
            if (requestValueSelectionSettingIsNull)
            {
                request.ValueSelectionSetting = 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);
        }