grantAccess method

Future<GrantAccessResult> grantAccess({
  1. required String instanceId,
  2. int? validForInMinutes,
})
Grants RDP access to a Windows instance for a specified time period.

May throw ValidationException. May throw ResourceNotFoundException.

Parameter instanceId : The instance's AWS OpsWorks Stacks ID.

Parameter validForInMinutes : The length of time (in minutes) that the grant is valid. When the grant expires at the end of this period, the user will no longer be able to use the credentials to log in. If the user is logged in at the time, he or she automatically will be logged out.

Implementation

Future<GrantAccessResult> grantAccess({
  required String instanceId,
  int? validForInMinutes,
}) async {
  ArgumentError.checkNotNull(instanceId, 'instanceId');
  _s.validateNumRange(
    'validForInMinutes',
    validForInMinutes,
    60,
    1440,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'OpsWorks_20130218.GrantAccess'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'InstanceId': instanceId,
      if (validForInMinutes != null) 'ValidForInMinutes': validForInMinutes,
    },
  );

  return GrantAccessResult.fromJson(jsonResponse.body);
}