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

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

            // populate CachingConfig
            var requestCachingConfigIsNull = true;

            request.CachingConfig = new Amazon.AppSync.Model.CachingConfig();
            List <System.String> requestCachingConfig_cachingConfig_CachingKey = null;

            if (cmdletContext.CachingConfig_CachingKey != null)
            {
                requestCachingConfig_cachingConfig_CachingKey = cmdletContext.CachingConfig_CachingKey;
            }
            if (requestCachingConfig_cachingConfig_CachingKey != null)
            {
                request.CachingConfig.CachingKeys = requestCachingConfig_cachingConfig_CachingKey;
                requestCachingConfigIsNull        = false;
            }
            System.Int64?requestCachingConfig_cachingConfig_Ttl = null;
            if (cmdletContext.CachingConfig_Ttl != null)
            {
                requestCachingConfig_cachingConfig_Ttl = cmdletContext.CachingConfig_Ttl.Value;
            }
            if (requestCachingConfig_cachingConfig_Ttl != null)
            {
                request.CachingConfig.Ttl  = requestCachingConfig_cachingConfig_Ttl.Value;
                requestCachingConfigIsNull = false;
            }
            // determine if request.CachingConfig should be set to null
            if (requestCachingConfigIsNull)
            {
                request.CachingConfig = null;
            }
            if (cmdletContext.DataSourceName != null)
            {
                request.DataSourceName = cmdletContext.DataSourceName;
            }
            if (cmdletContext.FieldName != null)
            {
                request.FieldName = cmdletContext.FieldName;
            }
            if (cmdletContext.Kind != null)
            {
                request.Kind = cmdletContext.Kind;
            }

            // populate PipelineConfig
            var requestPipelineConfigIsNull = true;

            request.PipelineConfig = new Amazon.AppSync.Model.PipelineConfig();
            List <System.String> requestPipelineConfig_pipelineConfig_Function = null;

            if (cmdletContext.PipelineConfig_Function != null)
            {
                requestPipelineConfig_pipelineConfig_Function = cmdletContext.PipelineConfig_Function;
            }
            if (requestPipelineConfig_pipelineConfig_Function != null)
            {
                request.PipelineConfig.Functions = requestPipelineConfig_pipelineConfig_Function;
                requestPipelineConfigIsNull      = false;
            }
            // determine if request.PipelineConfig should be set to null
            if (requestPipelineConfigIsNull)
            {
                request.PipelineConfig = null;
            }
            if (cmdletContext.RequestMappingTemplate != null)
            {
                request.RequestMappingTemplate = cmdletContext.RequestMappingTemplate;
            }
            if (cmdletContext.ResponseMappingTemplate != null)
            {
                request.ResponseMappingTemplate = cmdletContext.ResponseMappingTemplate;
            }

            // populate SyncConfig
            var requestSyncConfigIsNull = true;

            request.SyncConfig = new Amazon.AppSync.Model.SyncConfig();
            Amazon.AppSync.ConflictDetectionType requestSyncConfig_syncConfig_ConflictDetection = null;
            if (cmdletContext.SyncConfig_ConflictDetection != null)
            {
                requestSyncConfig_syncConfig_ConflictDetection = cmdletContext.SyncConfig_ConflictDetection;
            }
            if (requestSyncConfig_syncConfig_ConflictDetection != null)
            {
                request.SyncConfig.ConflictDetection = requestSyncConfig_syncConfig_ConflictDetection;
                requestSyncConfigIsNull = false;
            }
            Amazon.AppSync.ConflictHandlerType requestSyncConfig_syncConfig_ConflictHandler = null;
            if (cmdletContext.SyncConfig_ConflictHandler != null)
            {
                requestSyncConfig_syncConfig_ConflictHandler = cmdletContext.SyncConfig_ConflictHandler;
            }
            if (requestSyncConfig_syncConfig_ConflictHandler != null)
            {
                request.SyncConfig.ConflictHandler = requestSyncConfig_syncConfig_ConflictHandler;
                requestSyncConfigIsNull            = false;
            }
            Amazon.AppSync.Model.LambdaConflictHandlerConfig requestSyncConfig_syncConfig_LambdaConflictHandlerConfig = null;

            // populate LambdaConflictHandlerConfig
            var requestSyncConfig_syncConfig_LambdaConflictHandlerConfigIsNull = true;

            requestSyncConfig_syncConfig_LambdaConflictHandlerConfig = new Amazon.AppSync.Model.LambdaConflictHandlerConfig();
            System.String requestSyncConfig_syncConfig_LambdaConflictHandlerConfig_lambdaConflictHandlerConfig_LambdaConflictHandlerArn = null;
            if (cmdletContext.LambdaConflictHandlerConfig_LambdaConflictHandlerArn != null)
            {
                requestSyncConfig_syncConfig_LambdaConflictHandlerConfig_lambdaConflictHandlerConfig_LambdaConflictHandlerArn = cmdletContext.LambdaConflictHandlerConfig_LambdaConflictHandlerArn;
            }
            if (requestSyncConfig_syncConfig_LambdaConflictHandlerConfig_lambdaConflictHandlerConfig_LambdaConflictHandlerArn != null)
            {
                requestSyncConfig_syncConfig_LambdaConflictHandlerConfig.LambdaConflictHandlerArn = requestSyncConfig_syncConfig_LambdaConflictHandlerConfig_lambdaConflictHandlerConfig_LambdaConflictHandlerArn;
                requestSyncConfig_syncConfig_LambdaConflictHandlerConfigIsNull = false;
            }
            // determine if requestSyncConfig_syncConfig_LambdaConflictHandlerConfig should be set to null
            if (requestSyncConfig_syncConfig_LambdaConflictHandlerConfigIsNull)
            {
                requestSyncConfig_syncConfig_LambdaConflictHandlerConfig = null;
            }
            if (requestSyncConfig_syncConfig_LambdaConflictHandlerConfig != null)
            {
                request.SyncConfig.LambdaConflictHandlerConfig = requestSyncConfig_syncConfig_LambdaConflictHandlerConfig;
                requestSyncConfigIsNull = false;
            }
            // determine if request.SyncConfig should be set to null
            if (requestSyncConfigIsNull)
            {
                request.SyncConfig = null;
            }
            if (cmdletContext.TypeName != null)
            {
                request.TypeName = cmdletContext.TypeName;
            }

            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);
        }
 private Amazon.AppSync.Model.UpdateResolverResponse CallAWSServiceOperation(IAmazonAppSync client, Amazon.AppSync.Model.UpdateResolverRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS AppSync", "UpdateResolver");
     try
     {
         #if DESKTOP
         return(client.UpdateResolver(request));
         #elif CORECLR
         return(client.UpdateResolverAsync(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;
     }
 }
Exemple #3
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.AppSync.Model.UpdateResolverRequest();

            if (cmdletContext.ApiId != null)
            {
                request.ApiId = cmdletContext.ApiId;
            }
            if (cmdletContext.DataSourceName != null)
            {
                request.DataSourceName = cmdletContext.DataSourceName;
            }
            if (cmdletContext.FieldName != null)
            {
                request.FieldName = cmdletContext.FieldName;
            }
            if (cmdletContext.Kind != null)
            {
                request.Kind = cmdletContext.Kind;
            }

            // populate PipelineConfig
            var requestPipelineConfigIsNull = true;

            request.PipelineConfig = new Amazon.AppSync.Model.PipelineConfig();
            List <System.String> requestPipelineConfig_pipelineConfig_Function = null;

            if (cmdletContext.PipelineConfig_Function != null)
            {
                requestPipelineConfig_pipelineConfig_Function = cmdletContext.PipelineConfig_Function;
            }
            if (requestPipelineConfig_pipelineConfig_Function != null)
            {
                request.PipelineConfig.Functions = requestPipelineConfig_pipelineConfig_Function;
                requestPipelineConfigIsNull      = false;
            }
            // determine if request.PipelineConfig should be set to null
            if (requestPipelineConfigIsNull)
            {
                request.PipelineConfig = null;
            }
            if (cmdletContext.RequestMappingTemplate != null)
            {
                request.RequestMappingTemplate = cmdletContext.RequestMappingTemplate;
            }
            if (cmdletContext.ResponseMappingTemplate != null)
            {
                request.ResponseMappingTemplate = cmdletContext.ResponseMappingTemplate;
            }
            if (cmdletContext.TypeName != null)
            {
                request.TypeName = cmdletContext.TypeName;
            }

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