createOpsMetadata method

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

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

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

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

Parameter metadata : Metadata for a new Application Manager application.

Implementation

Future<CreateOpsMetadataResult> createOpsMetadata({
  required String resourceId,
  Map<String, MetadataValue>? metadata,
}) async {
  ArgumentError.checkNotNull(resourceId, 'resourceId');
  _s.validateStringLength(
    'resourceId',
    resourceId,
    1,
    1024,
    isRequired: true,
  );
  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,
    },
  );

  return CreateOpsMetadataResult.fromJson(jsonResponse.body);
}