public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Personalize.Model.UpdateCampaignRequest();

            if (cmdletContext.CampaignArn != null)
            {
                request.CampaignArn = cmdletContext.CampaignArn;
            }
            if (cmdletContext.MinProvisionedTPS != null)
            {
                request.MinProvisionedTPS = cmdletContext.MinProvisionedTPS.Value;
            }
            if (cmdletContext.SolutionVersionArn != null)
            {
                request.SolutionVersionArn = cmdletContext.SolutionVersionArn;
            }

            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);
        }
示例#2
0
 private Amazon.Personalize.Model.UpdateCampaignResponse CallAWSServiceOperation(IAmazonPersonalize client, Amazon.Personalize.Model.UpdateCampaignRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Personalize", "UpdateCampaign");
     try
     {
         #if DESKTOP
         return(client.UpdateCampaign(request));
         #elif CORECLR
         return(client.UpdateCampaignAsync(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;
     }
 }
示例#3
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Personalize.Model.UpdateCampaignRequest();

            if (cmdletContext.CampaignArn != null)
            {
                request.CampaignArn = cmdletContext.CampaignArn;
            }

            // populate CampaignConfig
            var requestCampaignConfigIsNull = true;

            request.CampaignConfig = new Amazon.Personalize.Model.CampaignConfig();
            Dictionary <System.String, System.String> requestCampaignConfig_campaignConfig_ItemExplorationConfig = null;

            if (cmdletContext.CampaignConfig_ItemExplorationConfig != null)
            {
                requestCampaignConfig_campaignConfig_ItemExplorationConfig = cmdletContext.CampaignConfig_ItemExplorationConfig;
            }
            if (requestCampaignConfig_campaignConfig_ItemExplorationConfig != null)
            {
                request.CampaignConfig.ItemExplorationConfig = requestCampaignConfig_campaignConfig_ItemExplorationConfig;
                requestCampaignConfigIsNull = false;
            }
            // determine if request.CampaignConfig should be set to null
            if (requestCampaignConfigIsNull)
            {
                request.CampaignConfig = null;
            }
            if (cmdletContext.MinProvisionedTPS != null)
            {
                request.MinProvisionedTPS = cmdletContext.MinProvisionedTPS.Value;
            }
            if (cmdletContext.SolutionVersionArn != null)
            {
                request.SolutionVersionArn = cmdletContext.SolutionVersionArn;
            }

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