Esempio n. 1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Personalize.Model.UpdateRecommenderRequest();

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

            // populate RecommenderConfig
            var requestRecommenderConfigIsNull = true;

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

            if (cmdletContext.RecommenderConfig_ItemExplorationConfig != null)
            {
                requestRecommenderConfig_recommenderConfig_ItemExplorationConfig = cmdletContext.RecommenderConfig_ItemExplorationConfig;
            }
            if (requestRecommenderConfig_recommenderConfig_ItemExplorationConfig != null)
            {
                request.RecommenderConfig.ItemExplorationConfig = requestRecommenderConfig_recommenderConfig_ItemExplorationConfig;
                requestRecommenderConfigIsNull = false;
            }
            // determine if request.RecommenderConfig should be set to null
            if (requestRecommenderConfigIsNull)
            {
                request.RecommenderConfig = 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);
        }
Esempio n. 2
0
 private Amazon.Personalize.Model.UpdateRecommenderResponse CallAWSServiceOperation(IAmazonPersonalize client, Amazon.Personalize.Model.UpdateRecommenderRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Personalize", "UpdateRecommender");
     try
     {
         #if DESKTOP
         return(client.UpdateRecommender(request));
         #elif CORECLR
         return(client.UpdateRecommenderAsync(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;
     }
 }