startAccessRequest method

Future<StartAccessRequestResponse> startAccessRequest({
  1. required String reason,
  2. required List<Target> targets,
  3. List<Tag>? tags,
})

Starts the workflow for just-in-time node access sessions.

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

Parameter reason : A brief description explaining why you are requesting access to the node.

Parameter targets : The node you are requesting access to.

Parameter tags : Key-value pairs of metadata you want to assign to the access request.

Implementation

Future<StartAccessRequestResponse> startAccessRequest({
  required String reason,
  required List<Target> targets,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.StartAccessRequest'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Reason': reason,
      'Targets': targets,
      if (tags != null) 'Tags': tags,
    },
  );

  return StartAccessRequestResponse.fromJson(jsonResponse.body);
}