private Amazon.Kendra.Model.CreateExperienceResponse CallAWSServiceOperation(IAmazonKendra client, Amazon.Kendra.Model.CreateExperienceRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Kendra", "CreateExperience"); try { #if DESKTOP return(client.CreateExperience(request)); #elif CORECLR return(client.CreateExperienceAsync(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.CreateExperienceRequest(); if (cmdletContext.ClientToken != null) { request.ClientToken = cmdletContext.ClientToken; } // populate Configuration var requestConfigurationIsNull = true; request.Configuration = new Amazon.Kendra.Model.ExperienceConfiguration(); Amazon.Kendra.Model.UserIdentityConfiguration requestConfiguration_configuration_UserIdentityConfiguration = null; // populate UserIdentityConfiguration var requestConfiguration_configuration_UserIdentityConfigurationIsNull = true; requestConfiguration_configuration_UserIdentityConfiguration = new Amazon.Kendra.Model.UserIdentityConfiguration(); System.String requestConfiguration_configuration_UserIdentityConfiguration_userIdentityConfiguration_IdentityAttributeName = null; if (cmdletContext.UserIdentityConfiguration_IdentityAttributeName != null) { requestConfiguration_configuration_UserIdentityConfiguration_userIdentityConfiguration_IdentityAttributeName = cmdletContext.UserIdentityConfiguration_IdentityAttributeName; } if (requestConfiguration_configuration_UserIdentityConfiguration_userIdentityConfiguration_IdentityAttributeName != null) { requestConfiguration_configuration_UserIdentityConfiguration.IdentityAttributeName = requestConfiguration_configuration_UserIdentityConfiguration_userIdentityConfiguration_IdentityAttributeName; requestConfiguration_configuration_UserIdentityConfigurationIsNull = false; } // determine if requestConfiguration_configuration_UserIdentityConfiguration should be set to null if (requestConfiguration_configuration_UserIdentityConfigurationIsNull) { requestConfiguration_configuration_UserIdentityConfiguration = null; } if (requestConfiguration_configuration_UserIdentityConfiguration != null) { request.Configuration.UserIdentityConfiguration = requestConfiguration_configuration_UserIdentityConfiguration; requestConfigurationIsNull = false; } Amazon.Kendra.Model.ContentSourceConfiguration requestConfiguration_configuration_ContentSourceConfiguration = null; // populate ContentSourceConfiguration var requestConfiguration_configuration_ContentSourceConfigurationIsNull = true; requestConfiguration_configuration_ContentSourceConfiguration = new Amazon.Kendra.Model.ContentSourceConfiguration(); List <System.String> requestConfiguration_configuration_ContentSourceConfiguration_contentSourceConfiguration_DataSourceId = null; if (cmdletContext.ContentSourceConfiguration_DataSourceId != null) { requestConfiguration_configuration_ContentSourceConfiguration_contentSourceConfiguration_DataSourceId = cmdletContext.ContentSourceConfiguration_DataSourceId; } if (requestConfiguration_configuration_ContentSourceConfiguration_contentSourceConfiguration_DataSourceId != null) { requestConfiguration_configuration_ContentSourceConfiguration.DataSourceIds = requestConfiguration_configuration_ContentSourceConfiguration_contentSourceConfiguration_DataSourceId; requestConfiguration_configuration_ContentSourceConfigurationIsNull = false; } System.Boolean?requestConfiguration_configuration_ContentSourceConfiguration_contentSourceConfiguration_DirectPutContent = null; if (cmdletContext.ContentSourceConfiguration_DirectPutContent != null) { requestConfiguration_configuration_ContentSourceConfiguration_contentSourceConfiguration_DirectPutContent = cmdletContext.ContentSourceConfiguration_DirectPutContent.Value; } if (requestConfiguration_configuration_ContentSourceConfiguration_contentSourceConfiguration_DirectPutContent != null) { requestConfiguration_configuration_ContentSourceConfiguration.DirectPutContent = requestConfiguration_configuration_ContentSourceConfiguration_contentSourceConfiguration_DirectPutContent.Value; requestConfiguration_configuration_ContentSourceConfigurationIsNull = false; } List <System.String> requestConfiguration_configuration_ContentSourceConfiguration_contentSourceConfiguration_FaqId = null; if (cmdletContext.ContentSourceConfiguration_FaqId != null) { requestConfiguration_configuration_ContentSourceConfiguration_contentSourceConfiguration_FaqId = cmdletContext.ContentSourceConfiguration_FaqId; } if (requestConfiguration_configuration_ContentSourceConfiguration_contentSourceConfiguration_FaqId != null) { requestConfiguration_configuration_ContentSourceConfiguration.FaqIds = requestConfiguration_configuration_ContentSourceConfiguration_contentSourceConfiguration_FaqId; requestConfiguration_configuration_ContentSourceConfigurationIsNull = false; } // determine if requestConfiguration_configuration_ContentSourceConfiguration should be set to null if (requestConfiguration_configuration_ContentSourceConfigurationIsNull) { requestConfiguration_configuration_ContentSourceConfiguration = null; } if (requestConfiguration_configuration_ContentSourceConfiguration != null) { request.Configuration.ContentSourceConfiguration = requestConfiguration_configuration_ContentSourceConfiguration; requestConfigurationIsNull = false; } // determine if request.Configuration should be set to null if (requestConfigurationIsNull) { request.Configuration = null; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.IndexId != null) { request.IndexId = cmdletContext.IndexId; } 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); }