createExperience method

Future<CreateExperienceResponse> createExperience({
  1. required String indexId,
  2. required String name,
  3. String? clientToken,
  4. ExperienceConfiguration? configuration,
  5. String? description,
  6. String? roleArn,
})

Creates an Amazon Kendra experience such as a search application. For more information on creating a search application experience, including using the Python and Java SDKs, see Building a search experience with no code.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter indexId : The identifier of the index for your Amazon Kendra experience.

Parameter name : A name for your Amazon Kendra experience.

Parameter clientToken : A token that you provide to identify the request to create your Amazon Kendra experience. Multiple calls to the CreateExperience API with the same client token creates only one Amazon Kendra experience.

Parameter configuration : Configuration information for your Amazon Kendra experience. This includes ContentSourceConfiguration, which specifies the data source IDs and/or FAQ IDs, and UserIdentityConfiguration, which specifies the user or group information to grant access to your Amazon Kendra experience.

Parameter description : A description for your Amazon Kendra experience.

Parameter roleArn : The Amazon Resource Name (ARN) of an IAM role with permission to access Query API, GetQuerySuggestions API, and other required APIs. The role also must include permission to access IAM Identity Center that stores your user and group information. For more information, see IAM access roles for Amazon Kendra.

Implementation

Future<CreateExperienceResponse> createExperience({
  required String indexId,
  required String name,
  String? clientToken,
  ExperienceConfiguration? configuration,
  String? description,
  String? roleArn,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSKendraFrontendService.CreateExperience'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'IndexId': indexId,
      'Name': name,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (configuration != null) 'Configuration': configuration,
      if (description != null) 'Description': description,
      if (roleArn != null) 'RoleArn': roleArn,
    },
  );

  return CreateExperienceResponse.fromJson(jsonResponse.body);
}