deleteOriginRequestPolicy2020_05_31 method

Future<void> deleteOriginRequestPolicy2020_05_31({
  1. required String id,
  2. String? ifMatch,
})

Deletes an origin request policy.

You cannot delete an origin request policy if it’s attached to any cache behaviors. First update your distributions to remove the origin request policy from all cache behaviors, then delete the origin request policy.

To delete an origin request policy, you must provide the policy’s identifier and version. To get the identifier, you can use ListOriginRequestPolicies or GetOriginRequestPolicy.

May throw AccessDenied. May throw InvalidIfMatchVersion. May throw NoSuchOriginRequestPolicy. May throw PreconditionFailed. May throw IllegalDelete. May throw OriginRequestPolicyInUse.

Parameter id : The unique identifier for the origin request policy that you are deleting. To get the identifier, you can use ListOriginRequestPolicies.

Parameter ifMatch : The version of the origin request policy that you are deleting. The version is the origin request policy’s ETag value, which you can get using ListOriginRequestPolicies, GetOriginRequestPolicy, or GetOriginRequestPolicyConfig.

Implementation

Future<void> deleteOriginRequestPolicy2020_05_31({
  required String id,
  String? ifMatch,
}) async {
  ArgumentError.checkNotNull(id, 'id');
  final headers = <String, String>{
    if (ifMatch != null) 'If-Match': ifMatch.toString(),
  };
  await _protocol.send(
    method: 'DELETE',
    requestUri:
        '/2020-05-31/origin-request-policy/${Uri.encodeComponent(id)}',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
}