コード例 #1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Kendra.Model.CreateIndexRequest();

            if (cmdletContext.ClientToken != null)
            {
                request.ClientToken = cmdletContext.ClientToken;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.Edition != null)
            {
                request.Edition = cmdletContext.Edition;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.RoleArn != null)
            {
                request.RoleArn = cmdletContext.RoleArn;
            }

            // populate ServerSideEncryptionConfiguration
            var requestServerSideEncryptionConfigurationIsNull = true;

            request.ServerSideEncryptionConfiguration = new Amazon.Kendra.Model.ServerSideEncryptionConfiguration();
            System.String requestServerSideEncryptionConfiguration_serverSideEncryptionConfiguration_KmsKeyId = null;
            if (cmdletContext.ServerSideEncryptionConfiguration_KmsKeyId != null)
            {
                requestServerSideEncryptionConfiguration_serverSideEncryptionConfiguration_KmsKeyId = cmdletContext.ServerSideEncryptionConfiguration_KmsKeyId;
            }
            if (requestServerSideEncryptionConfiguration_serverSideEncryptionConfiguration_KmsKeyId != null)
            {
                request.ServerSideEncryptionConfiguration.KmsKeyId = requestServerSideEncryptionConfiguration_serverSideEncryptionConfiguration_KmsKeyId;
                requestServerSideEncryptionConfigurationIsNull     = false;
            }
            // determine if request.ServerSideEncryptionConfiguration should be set to null
            if (requestServerSideEncryptionConfigurationIsNull)
            {
                request.ServerSideEncryptionConfiguration = null;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }
            if (cmdletContext.UserContextPolicy != null)
            {
                request.UserContextPolicy = cmdletContext.UserContextPolicy;
            }

            // populate UserGroupResolutionConfiguration
            var requestUserGroupResolutionConfigurationIsNull = true;

            request.UserGroupResolutionConfiguration = new Amazon.Kendra.Model.UserGroupResolutionConfiguration();
            Amazon.Kendra.UserGroupResolutionMode requestUserGroupResolutionConfiguration_userGroupResolutionConfiguration_UserGroupResolutionMode = null;
            if (cmdletContext.UserGroupResolutionConfiguration_UserGroupResolutionMode != null)
            {
                requestUserGroupResolutionConfiguration_userGroupResolutionConfiguration_UserGroupResolutionMode = cmdletContext.UserGroupResolutionConfiguration_UserGroupResolutionMode;
            }
            if (requestUserGroupResolutionConfiguration_userGroupResolutionConfiguration_UserGroupResolutionMode != null)
            {
                request.UserGroupResolutionConfiguration.UserGroupResolutionMode = requestUserGroupResolutionConfiguration_userGroupResolutionConfiguration_UserGroupResolutionMode;
                requestUserGroupResolutionConfigurationIsNull = false;
            }
            // determine if request.UserGroupResolutionConfiguration should be set to null
            if (requestUserGroupResolutionConfigurationIsNull)
            {
                request.UserGroupResolutionConfiguration = null;
            }
            if (cmdletContext.UserTokenConfiguration != null)
            {
                request.UserTokenConfigurations = cmdletContext.UserTokenConfiguration;
            }

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


            // populate CapacityUnits
            var requestCapacityUnitsIsNull = true;

            request.CapacityUnits = new Amazon.Kendra.Model.CapacityUnitsConfiguration();
            System.Int32?requestCapacityUnits_capacityUnits_QueryCapacityUnit = null;
            if (cmdletContext.CapacityUnits_QueryCapacityUnit != null)
            {
                requestCapacityUnits_capacityUnits_QueryCapacityUnit = cmdletContext.CapacityUnits_QueryCapacityUnit.Value;
            }
            if (requestCapacityUnits_capacityUnits_QueryCapacityUnit != null)
            {
                request.CapacityUnits.QueryCapacityUnits = requestCapacityUnits_capacityUnits_QueryCapacityUnit.Value;
                requestCapacityUnitsIsNull = false;
            }
            System.Int32?requestCapacityUnits_capacityUnits_StorageCapacityUnit = null;
            if (cmdletContext.CapacityUnits_StorageCapacityUnit != null)
            {
                requestCapacityUnits_capacityUnits_StorageCapacityUnit = cmdletContext.CapacityUnits_StorageCapacityUnit.Value;
            }
            if (requestCapacityUnits_capacityUnits_StorageCapacityUnit != null)
            {
                request.CapacityUnits.StorageCapacityUnits = requestCapacityUnits_capacityUnits_StorageCapacityUnit.Value;
                requestCapacityUnitsIsNull = false;
            }
            // determine if request.CapacityUnits should be set to null
            if (requestCapacityUnitsIsNull)
            {
                request.CapacityUnits = null;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.DocumentMetadataConfigurationUpdate != null)
            {
                request.DocumentMetadataConfigurationUpdates = cmdletContext.DocumentMetadataConfigurationUpdate;
            }
            if (cmdletContext.Id != null)
            {
                request.Id = cmdletContext.Id;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.RoleArn != null)
            {
                request.RoleArn = cmdletContext.RoleArn;
            }
            if (cmdletContext.UserContextPolicy != null)
            {
                request.UserContextPolicy = cmdletContext.UserContextPolicy;
            }

            // populate UserGroupResolutionConfiguration
            var requestUserGroupResolutionConfigurationIsNull = true;

            request.UserGroupResolutionConfiguration = new Amazon.Kendra.Model.UserGroupResolutionConfiguration();
            Amazon.Kendra.UserGroupResolutionMode requestUserGroupResolutionConfiguration_userGroupResolutionConfiguration_UserGroupResolutionMode = null;
            if (cmdletContext.UserGroupResolutionConfiguration_UserGroupResolutionMode != null)
            {
                requestUserGroupResolutionConfiguration_userGroupResolutionConfiguration_UserGroupResolutionMode = cmdletContext.UserGroupResolutionConfiguration_UserGroupResolutionMode;
            }
            if (requestUserGroupResolutionConfiguration_userGroupResolutionConfiguration_UserGroupResolutionMode != null)
            {
                request.UserGroupResolutionConfiguration.UserGroupResolutionMode = requestUserGroupResolutionConfiguration_userGroupResolutionConfiguration_UserGroupResolutionMode;
                requestUserGroupResolutionConfigurationIsNull = false;
            }
            // determine if request.UserGroupResolutionConfiguration should be set to null
            if (requestUserGroupResolutionConfigurationIsNull)
            {
                request.UserGroupResolutionConfiguration = null;
            }
            if (cmdletContext.UserTokenConfiguration != null)
            {
                request.UserTokenConfigurations = cmdletContext.UserTokenConfiguration;
            }

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