updateOpsMetadata method

Future<UpdateOpsMetadataResult> updateOpsMetadata({
  1. required String opsMetadataArn,
  2. List<String>? keysToDelete,
  3. Map<String, MetadataValue>? metadataToUpdate,
})

Systems Manager calls this API action when you edit OpsMetadata in Application Manager.

May throw OpsMetadataNotFoundException. May throw OpsMetadataInvalidArgumentException. May throw OpsMetadataKeyLimitExceededException. May throw OpsMetadataTooManyUpdatesException. May throw InternalServerError.

Parameter opsMetadataArn : The Amazon Resoure Name (ARN) of the OpsMetadata Object to update.

Parameter keysToDelete : The metadata keys to delete from the OpsMetadata object.

Parameter metadataToUpdate : Metadata to add to an OpsMetadata object.

Implementation

Future<UpdateOpsMetadataResult> updateOpsMetadata({
  required String opsMetadataArn,
  List<String>? keysToDelete,
  Map<String, MetadataValue>? metadataToUpdate,
}) async {
  ArgumentError.checkNotNull(opsMetadataArn, 'opsMetadataArn');
  _s.validateStringLength(
    'opsMetadataArn',
    opsMetadataArn,
    1,
    1011,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.UpdateOpsMetadata'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'OpsMetadataArn': opsMetadataArn,
      if (keysToDelete != null) 'KeysToDelete': keysToDelete,
      if (metadataToUpdate != null) 'MetadataToUpdate': metadataToUpdate,
    },
  );

  return UpdateOpsMetadataResult.fromJson(jsonResponse.body);
}