describeProtection method

Future<DescribeProtectionResponse> describeProtection({
  1. String? protectionId,
  2. String? resourceArn,
})

Lists the details of a Protection object.

May throw InternalErrorException. May throw InvalidParameterException. May throw ResourceNotFoundException.

Parameter protectionId : The unique identifier (ID) for the Protection object that is described. When submitting the DescribeProtection request you must provide either the ResourceArn or the ProtectionID, but not both.

Parameter resourceArn : The ARN (Amazon Resource Name) of the AWS resource for the Protection object that is described. When submitting the DescribeProtection request you must provide either the ResourceArn or the ProtectionID, but not both.

Implementation

Future<DescribeProtectionResponse> describeProtection({
  String? protectionId,
  String? resourceArn,
}) async {
  _s.validateStringLength(
    'protectionId',
    protectionId,
    1,
    36,
  );
  _s.validateStringLength(
    'resourceArn',
    resourceArn,
    1,
    2048,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSShield_20160616.DescribeProtection'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (protectionId != null) 'ProtectionId': protectionId,
      if (resourceArn != null) 'ResourceArn': resourceArn,
    },
  );

  return DescribeProtectionResponse.fromJson(jsonResponse.body);
}