createWorkload method

Future<CreateWorkloadOutput> createWorkload({
  1. required String description,
  2. required WorkloadEnvironment environment,
  3. required List<String> lenses,
  4. required String workloadName,
  5. List<String>? accountIds,
  6. List<String>? applications,
  7. String? architecturalDesign,
  8. List<String>? awsRegions,
  9. String? clientRequestToken,
  10. WorkloadDiscoveryConfig? discoveryConfig,
  11. String? industry,
  12. String? industryType,
  13. WorkloadJiraConfigurationInput? jiraConfiguration,
  14. List<String>? nonAwsRegions,
  15. String? notes,
  16. List<String>? pillarPriorities,
  17. List<String>? profileArns,
  18. String? reviewOwner,
  19. List<String>? reviewTemplateArns,
  20. Map<String, String>? tags,
})

Create a new workload.

The owner of a workload can share the workload with other Amazon Web Services accounts, users, an organization, and organizational units (OUs) in the same Amazon Web Services Region. Only the owner of a workload can delete it.

For more information, see Defining a Workload in the Well-Architected Tool User Guide.

You also must specify ReviewOwner, even though the parameter is listed as not being required in the following section. When creating a workload using a review template, you must have the following IAM permissions:

  • wellarchitected:GetReviewTemplate
  • wellarchitected:GetReviewTemplateAnswer
  • wellarchitected:ListReviewTemplateAnswers
  • wellarchitected:GetReviewTemplateLensReview

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

Parameter applications : List of AppRegistry application ARNs associated to the workload.

Parameter discoveryConfig : Well-Architected discovery configuration settings associated to the workload.

Parameter jiraConfiguration : Jira configuration settings when creating a workload.

Parameter profileArns : The list of profile ARNs associated with the workload.

Parameter reviewTemplateArns : The list of review template ARNs to associate with the workload.

Parameter tags : The tags to be associated with the workload.

Implementation

Future<CreateWorkloadOutput> createWorkload({
  required String description,
  required WorkloadEnvironment environment,
  required List<String> lenses,
  required String workloadName,
  List<String>? accountIds,
  List<String>? applications,
  String? architecturalDesign,
  List<String>? awsRegions,
  String? clientRequestToken,
  WorkloadDiscoveryConfig? discoveryConfig,
  String? industry,
  String? industryType,
  WorkloadJiraConfigurationInput? jiraConfiguration,
  List<String>? nonAwsRegions,
  String? notes,
  List<String>? pillarPriorities,
  List<String>? profileArns,
  String? reviewOwner,
  List<String>? reviewTemplateArns,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'Description': description,
    'Environment': environment.value,
    'Lenses': lenses,
    'WorkloadName': workloadName,
    if (accountIds != null) 'AccountIds': accountIds,
    if (applications != null) 'Applications': applications,
    if (architecturalDesign != null)
      'ArchitecturalDesign': architecturalDesign,
    if (awsRegions != null) 'AwsRegions': awsRegions,
    'ClientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
    if (discoveryConfig != null) 'DiscoveryConfig': discoveryConfig,
    if (industry != null) 'Industry': industry,
    if (industryType != null) 'IndustryType': industryType,
    if (jiraConfiguration != null) 'JiraConfiguration': jiraConfiguration,
    if (nonAwsRegions != null) 'NonAwsRegions': nonAwsRegions,
    if (notes != null) 'Notes': notes,
    if (pillarPriorities != null) 'PillarPriorities': pillarPriorities,
    if (profileArns != null) 'ProfileArns': profileArns,
    if (reviewOwner != null) 'ReviewOwner': reviewOwner,
    if (reviewTemplateArns != null) 'ReviewTemplateArns': reviewTemplateArns,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/workloads',
    exceptionFnMap: _exceptionFns,
  );
  return CreateWorkloadOutput.fromJson(response);
}