createOpsMetadata method

Future<CreateOpsMetadataResult> createOpsMetadata({
  1. required String resourceId,
  2. Map<String, MetadataValue>? metadata,
  3. List<Tag>? tags,
})

If you create a new application in Application Manager, Amazon Web Services Systems Manager calls this API operation to specify information about the new application, including the application type.

May throw InternalServerError. May throw OpsMetadataAlreadyExistsException. May throw OpsMetadataInvalidArgumentException. May throw OpsMetadataLimitExceededException. May throw OpsMetadataTooManyUpdatesException.

Parameter resourceId : A resource ID for a new Application Manager application.

Parameter metadata : Metadata for a new Application Manager application.

Parameter tags : Optional metadata that you assign to a resource. You can specify a maximum of five tags for an OpsMetadata object. Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag an OpsMetadata object to identify an environment or target Amazon Web Services Region. In this case, you could specify the following key-value pairs:

  • Key=Environment,Value=Production
  • Key=Region,Value=us-east-2

Implementation

Future<CreateOpsMetadataResult> createOpsMetadata({
  required String resourceId,
  Map<String, MetadataValue>? metadata,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.CreateOpsMetadata'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ResourceId': resourceId,
      if (metadata != null) 'Metadata': metadata,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateOpsMetadataResult.fromJson(jsonResponse.body);
}