publishDataTransformationProfile method

Future<PublishDataTransformationProfileResponse> publishDataTransformationProfile({
  1. required String profileId,
  2. required SourceFormat sourceFormat,
  3. String? changeDescription,
  4. int? fromExistingVersion,
})

Promotes the current DRAFT version of a data transformation profile to a new immutable published version. Also supports rollback by publishing from a previously published version.

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

Parameter profileId : The unique identifier of the profile to publish.

Parameter sourceFormat : The source data format of the profile.

Parameter changeDescription : A description of what changed or why this version is being published.

Parameter fromExistingVersion : The version number of a previously published version to republish as the new latest version. Use this parameter for rollback scenarios. If you omit this parameter, the service publishes the current DRAFT version.

Implementation

Future<PublishDataTransformationProfileResponse>
    publishDataTransformationProfile({
  required String profileId,
  required SourceFormat sourceFormat,
  String? changeDescription,
  int? fromExistingVersion,
}) async {
  _s.validateNumRange(
    'fromExistingVersion',
    fromExistingVersion,
    0,
    99,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'HealthLake.PublishDataTransformationProfile'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ProfileId': profileId,
      'SourceFormat': sourceFormat.value,
      if (changeDescription != null) 'ChangeDescription': changeDescription,
      if (fromExistingVersion != null)
        'FromExistingVersion': fromExistingVersion,
    },

    hostPrefix: 'datatransformation.',
  );

  return PublishDataTransformationProfileResponse.fromJson(jsonResponse.body);
}