Beispiel #1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Kendra.Model.UpdateIndexRequest();

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

            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.Kendra.Model.UpdateIndexResponse CallAWSServiceOperation(IAmazonKendra client, Amazon.Kendra.Model.UpdateIndexRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Kendra", "UpdateIndex");
     try
     {
         #if DESKTOP
         return(client.UpdateIndex(request));
         #elif CORECLR
         return(client.UpdateIndexAsync(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;
     }
 }
        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);
        }