createPlacement method

Future<void> createPlacement({
  1. required String placementName,
  2. required String projectName,
  3. Map<String, String>? attributes,
})

Creates an empty placement.

May throw InternalFailureException. May throw InvalidRequestException. May throw ResourceConflictException. May throw ResourceNotFoundException.

Parameter placementName : The name of the placement to be created.

Parameter projectName : The name of the project in which to create the placement.

Parameter attributes : Optional user-defined key/value pairs providing contextual data (such as location or function) for the placement.

Implementation

Future<void> createPlacement({
  required String placementName,
  required String projectName,
  Map<String, String>? attributes,
}) async {
  ArgumentError.checkNotNull(placementName, 'placementName');
  _s.validateStringLength(
    'placementName',
    placementName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(projectName, 'projectName');
  _s.validateStringLength(
    'projectName',
    projectName,
    1,
    128,
    isRequired: true,
  );
  final $payload = <String, dynamic>{
    'placementName': placementName,
    if (attributes != null) 'attributes': attributes,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/projects/${Uri.encodeComponent(projectName)}/placements',
    exceptionFnMap: _exceptionFns,
  );
}