createGroup method

Future<CreateGroupResponse> createGroup({
  1. String? amznClientToken,
  2. GroupVersion? initialVersion,
  3. String? name,
  4. Map<String, String>? tags,
})

Creates a group. You may provide the initial version of the group or use ''CreateGroupVersion'' at a later time. Tip: You can use the ''gg_group_setup'' package (https://github.com/awslabs/aws-greengrass-group-setup) as a library or command-line application to create and deploy Greengrass groups.

May throw BadRequestException.

Parameter amznClientToken : A client token used to correlate requests and responses.

Parameter initialVersion : Information about the initial version of the group.

Parameter name : The name of the group.

Parameter tags : Tag(s) to add to the new resource.

Implementation

Future<CreateGroupResponse> createGroup({
  String? amznClientToken,
  GroupVersion? initialVersion,
  String? name,
  Map<String, String>? tags,
}) async {
  final headers = <String, String>{
    if (amznClientToken != null)
      'X-Amzn-Client-Token': amznClientToken.toString(),
  };
  final $payload = <String, dynamic>{
    if (initialVersion != null) 'InitialVersion': initialVersion,
    if (name != null) 'Name': name,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/greengrass/groups',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return CreateGroupResponse.fromJson(response);
}