Creates an IPAM policy.
An IPAM policy is a set of rules that define how public IPv4 addresses from IPAM pools are allocated to Amazon Web Services resources. Each rule maps an Amazon Web Services service to IPAM pools that the service will use to get IP addresses. A single policy can have multiple rules and be applied to multiple Amazon Web Services Regions. If the IPAM pool run out of addresses then the services fallback to Amazon-provided IP addresses. A policy can be applied to an individual Amazon Web Services account or an entity within Amazon Web Services Organizations.
For more information, see Define public IPv4 allocation strategy with IPAM policies in the Amazon VPC IPAM User Guide.
Parameters:
-
dry_run
(Optional[Boolean], default:
None
)
–
A check for whether you have the required permissions for the action without actually making the request and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.
-
tag_specifications
(Optional[TagSpecificationList], default:
None
)
–
The tags to assign to the IPAM policy.
-
client_token
(Optional[String], default:
None
)
–
A unique, case-sensitive identifier to ensure the idempotency of the request.
-
ipam_id
(Optional[IpamId], default:
None
)
–
The ID of the IPAM for which you're creating the policy.
Raises:
Source code in docs_src/capo_ec2/_services/ec2.py
| def create_ipam_policy(
self,
*,
config_overrides: Optional[EC2ClientConfig] = None,
dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
tag_specifications: Optional[
"capo_ec2.types.tag_specification_list.TagSpecificationList"
] = None,
client_token: Optional["capo_ec2.types.string.String"] = None,
ipam_id: Optional["capo_ec2.types.ipam_id.IpamId"] = None,
) -> "capo_ec2.types.create_ipam_policy_result.CreateIpamPolicyResult":
"""<p>Creates an IPAM policy.</p> <p>An IPAM policy is a set of rules that define how public IPv4 addresses from IPAM pools are allocated to Amazon Web Services resources. Each rule maps an Amazon Web Services service to IPAM pools that the service will use to get IP addresses. A single policy can have multiple rules and be applied to multiple Amazon Web Services Regions. If the IPAM pool run out of addresses then the services fallback to Amazon-provided IP addresses. A policy can be applied to an individual Amazon Web Services account or an entity within Amazon Web Services Organizations.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/vpc/latest/ipam/define-public-ipv4-allocation-strategy-with-ipam-policies.html">Define public IPv4 allocation strategy with IPAM policies</a> in the <i>Amazon VPC IPAM User Guide</i>.</p>
Args:
dry_run: <p>A check for whether you have the required permissions for the action without actually making the request and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
tag_specifications: <p>The tags to assign to the IPAM policy.</p>
client_token: <p>A unique, case-sensitive identifier to ensure the idempotency of the request.</p>
ipam_id: <p>The ID of the IPAM for which you're creating the policy.</p>
Raises:
capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_ec2.types.create_ipam_policy_request.CreateIpamPolicyRequest]",
) -> OperationResponse[
"capo_ec2.types.create_ipam_policy_result.CreateIpamPolicyResult"
]:
import capo_ec2._operations.amazon_ec2.create_ipam_policy
output, http_response = (
capo_ec2._operations.amazon_ec2.create_ipam_policy.create_ipam_policy(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateIpamPolicy")
)
input_: capo_ec2.types.create_ipam_policy_request.CreateIpamPolicyRequest = {}
if dry_run is not None:
input_["dry_run"] = dry_run
if tag_specifications is not None:
input_["tag_specifications"] = tag_specifications
if client_token is None:
client_token = str(uuid.uuid4())
input_["client_token"] = client_token
if ipam_id is not None:
input_["ipam_id"] = ipam_id
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|