createVPCAssociationAuthorization method

Future<CreateVPCAssociationAuthorizationResponse> createVPCAssociationAuthorization({
  1. required String hostedZoneId,
  2. required VPC vpc,
})

Authorizes the AWS account that created a specified VPC to submit an AssociateVPCWithHostedZone request to associate the VPC with a specified hosted zone that was created by a different account. To submit a CreateVPCAssociationAuthorization request, you must use the account that created the hosted zone. After you authorize the association, use the account that created the VPC to submit an AssociateVPCWithHostedZone request.

May throw ConcurrentModification. May throw TooManyVPCAssociationAuthorizations. May throw NoSuchHostedZone. May throw InvalidVPCId. May throw InvalidInput.

Parameter hostedZoneId : The ID of the private hosted zone that you want to authorize associating a VPC with.

Parameter vpc : A complex type that contains the VPC ID and region for the VPC that you want to authorize associating with your hosted zone.

Implementation

Future<CreateVPCAssociationAuthorizationResponse>
    createVPCAssociationAuthorization({
  required String hostedZoneId,
  required VPC vpc,
}) 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)}/authorizevpcassociation',
    payload: CreateVPCAssociationAuthorizationRequest(
            hostedZoneId: hostedZoneId, vpc: vpc)
        .toXml(
      'CreateVPCAssociationAuthorizationRequest',
      attributes: [
        _s.XmlAttribute(_s.XmlName('xmlns'),
            'https://route53.amazonaws.com/doc/2013-04-01/'),
      ],
    ),
    exceptionFnMap: _exceptionFns,
  );
  return CreateVPCAssociationAuthorizationResponse.fromXml($result.body);
}