associateResolverRule method

Future<AssociateResolverRuleResponse> associateResolverRule({
  1. required String resolverRuleId,
  2. required String vPCId,
  3. String? name,
})

Associates a Resolver rule with a VPC. When you associate a rule with a VPC, Resolver forwards all DNS queries for the domain name that is specified in the rule and that originate in the VPC. The queries are forwarded to the IP addresses for the DNS resolvers that are specified in the rule. For more information about rules, see CreateResolverRule.

May throw ResourceNotFoundException. May throw InvalidRequestException. May throw LimitExceededException. May throw InvalidParameterException. May throw ResourceUnavailableException. May throw ResourceExistsException. May throw InternalServiceErrorException. May throw ThrottlingException.

Parameter resolverRuleId : The ID of the Resolver rule that you want to associate with the VPC. To list the existing Resolver rules, use ListResolverRules.

Parameter vPCId : The ID of the VPC that you want to associate the Resolver rule with.

Parameter name : A name for the association that you're creating between a Resolver rule and a VPC.

Implementation

Future<AssociateResolverRuleResponse> associateResolverRule({
  required String resolverRuleId,
  required String vPCId,
  String? name,
}) async {
  ArgumentError.checkNotNull(resolverRuleId, 'resolverRuleId');
  _s.validateStringLength(
    'resolverRuleId',
    resolverRuleId,
    1,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(vPCId, 'vPCId');
  _s.validateStringLength(
    'vPCId',
    vPCId,
    1,
    64,
    isRequired: true,
  );
  _s.validateStringLength(
    'name',
    name,
    0,
    64,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Route53Resolver.AssociateResolverRule'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ResolverRuleId': resolverRuleId,
      'VPCId': vPCId,
      if (name != null) 'Name': name,
    },
  );

  return AssociateResolverRuleResponse.fromJson(jsonResponse.body);
}