associateVPCWithHostedZone method

Future<AssociateVPCWithHostedZoneResponse> associateVPCWithHostedZone({
  1. required String hostedZoneId,
  2. required VPC vpc,
  3. String? comment,
})

Associates an Amazon VPC with a private hosted zone.

May throw NoSuchHostedZone. May throw NotAuthorizedException. May throw InvalidVPCId. May throw InvalidInput. May throw PublicZoneVPCAssociation. May throw ConflictingDomainExists. May throw LimitsExceeded. May throw PriorRequestNotComplete.

Parameter hostedZoneId : The ID of the private hosted zone that you want to associate an Amazon VPC with.

Note that you can't associate a VPC with a hosted zone that doesn't have an existing VPC association.

Parameter vpc : A complex type that contains information about the VPC that you want to associate with a private hosted zone.

Parameter comment : Optional: A comment about the association request.

Implementation

Future<AssociateVPCWithHostedZoneResponse> associateVPCWithHostedZone({
  required String hostedZoneId,
  required VPC vpc,
  String? comment,
}) async {
  ArgumentError.checkNotNull(hostedZoneId, 'hostedZoneId');
  _s.validateStringLength(
    'hostedZoneId',
    hostedZoneId,
    0,
    32,
    isRequired: true,
  );
  ArgumentError.checkNotNull(vpc, 'vpc');
  final $result = await _protocol.send(
    method: 'POST',
    requestUri:
        '/2013-04-01/hostedzone/${Uri.encodeComponent(hostedZoneId)}/associatevpc',
    payload: AssociateVPCWithHostedZoneRequest(
            hostedZoneId: hostedZoneId, vpc: vpc, comment: comment)
        .toXml(
      'AssociateVPCWithHostedZoneRequest',
      attributes: [
        _s.XmlAttribute(_s.XmlName('xmlns'),
            'https://route53.amazonaws.com/doc/2013-04-01/'),
      ],
    ),
    exceptionFnMap: _exceptionFns,
  );
  return AssociateVPCWithHostedZoneResponse.fromXml($result.body);
}