addAssociation method

Inserts an association for the specified security policy.

This has billing implications. Projects in the hierarchy with effective hierarchical security policies will be automatically enrolled into Cloud Armor Enterprise if not already enrolled.

Use this API to modify Cloud Armor policies. Previously, alpha and beta versions of this API were used to modify firewall policies. This usage is now disabled for most organizations. Use firewallPolicies.addAssociation instead.

Throws a http.ClientException if there were problems communicating with the API service. Throws a ServiceException if the API method failed for any reason.

Implementation

Future<Operation> addAssociation(
  AddAssociationOrganizationSecurityPolicyRequest request,
) async {
  final url = _endPoint.replace(
    path:
        '/compute/v1/locations/global/securityPolicies/${request.securityPolicy}/addAssociation',
    queryParameters: {
      if (request.replaceExistingAssociation case final $1?)
        'replaceExistingAssociation': '${$1}',
      'requestId': ?request.requestId,
    },
  );
  final response = await _client.post(
    url,
    body: request.securityPolicyAssociationResource,
  );
  return Operation.fromJson(response);
}