createProfile method

Future<CreateProfileResponse> createProfile({
  1. required String as2Id,
  2. required ProfileType profileType,
  3. List<String>? certificateIds,
  4. List<Tag>? tags,
})

Creates the local or partner profile to use for AS2 transfers.

May throw InternalServiceError. May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ServiceUnavailableException. May throw ThrottlingException.

Parameter as2Id : The As2Id is the AS2-name, as defined in the RFC 4130. For inbound transfers, this is the AS2-From header for the AS2 messages sent from the partner. For outbound connectors, this is the AS2-To header for the AS2 messages sent to the partner using the StartFileTransfer API operation. This ID cannot include spaces.

Parameter profileType : Determines the type of profile to create:

  • Specify LOCAL to create a local profile. A local profile represents the AS2-enabled Transfer Family server organization or party.
  • Specify PARTNER to create a partner profile. A partner profile represents a remote organization, external to Transfer Family.

Parameter certificateIds : An array of identifiers for the imported certificates. You use this identifier for working with profiles and partner profiles.

Parameter tags : Key-value pairs that can be used to group and search for AS2 profiles.

Implementation

Future<CreateProfileResponse> createProfile({
  required String as2Id,
  required ProfileType profileType,
  List<String>? certificateIds,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'TransferService.CreateProfile'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'As2Id': as2Id,
      'ProfileType': profileType.value,
      if (certificateIds != null) 'CertificateIds': certificateIds,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateProfileResponse.fromJson(jsonResponse.body);
}